Genshin/phantom_svg

View on GitHub
lib/phantom/parser/abstract_image_reader.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Phantom
  module SVG
    module Parser
      # Image reader.
      class AbstractImageReader
        attr_reader :frames, :width, :height, :loops, :skip_first, :has_animation
        alias_method :has_animation?, :has_animation

        # Construct AbstractImageReader object.
        def initialize(path = nil, options = {})
          read(path, options)
        end

        # Read image file from path.
        def read(_path, _options = {})
          fail 'Called abstract method.'
        end

        private

        # Reset SVGReader object.
        def reset
          @frames = []
          @width = nil
          @height = nil
          @loops = nil
          @skip_first = nil
          @has_animation = false
        end
      end # class AbstractImageReader
    end # module Parser
  end # module SVG
end # module Phantom