Sha256: 4a9515b470db3be52b3b202c2317ff7102ad682f596d9bb5a7b7b07e696b7796

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

require "forwardable"

module Asciimation
  class Animator
    def initialize(io: , options: )
      animator = options.delete(:animator)
      name     = "#{animator}_animator"
      file     = File.join(__dir__, name)
      require_relative file

      @animator = Asciimation.const_get(
        name.capitalize.gsub(/_([a-z])/) { $1.upcase }
      ).new(io: io, options: options)
    rescue LoadError
      abort "Error:  no such animator %p" % animator
    end

    extend         Forwardable
    def_delegators :@animator, :animate
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asciimation-0.1.0 lib/asciimation/animator.rb