hummingbird-me/kitsu-server

View on GitHub
lib/image_info.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

class ImageInfo
  def initialize(file_path)
    @file_path = file_path
  end

  def type
    if fastimage.type == :png && animated?
      :apng
    else
      fastimage.type
    end
  end

  def animated?
    FastImage.animated?(@file_path)
  end

  private

  def fastimage
    @fastimage ||= FastImage.new(@file_path)
  end
end