Class: Jani::StripMaker::FrameList
- Inherits:
-
Object
- Object
- Jani::StripMaker::FrameList
- Extended by:
- Forwardable
- Includes:
- Magick
- Defined in:
- lib/jani/strip_maker/frame_list.rb
Instance Attribute Summary collapse
-
#images ⇒ Object
readonly
Returns the value of attribute images.
Instance Method Summary collapse
- #append_image(image) ⇒ Object
- #append_image_with_filename(filename) ⇒ Object
-
#initialize(images: []) ⇒ FrameList
constructor
A new instance of FrameList.
- #to_strips ⇒ Object
Constructor Details
#initialize(images: []) ⇒ FrameList
Returns a new instance of FrameList.
11 12 13 |
# File 'lib/jani/strip_maker/frame_list.rb', line 11 def initialize(images: []) @images = images.dup end |
Instance Attribute Details
#images ⇒ Object (readonly)
Returns the value of attribute images.
9 10 11 |
# File 'lib/jani/strip_maker/frame_list.rb', line 9 def images @images end |
Instance Method Details
#append_image(image) ⇒ Object
15 16 17 |
# File 'lib/jani/strip_maker/frame_list.rb', line 15 def append_image(image) @images << image end |
#append_image_with_filename(filename) ⇒ Object
19 20 21 |
# File 'lib/jani/strip_maker/frame_list.rb', line 19 def append_image_with_filename(filename) append_image(Image.read(filename)[0]) end |
#to_strips ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/jani/strip_maker/frame_list.rb', line 23 def to_strips [].tap do |strips| index = 1 while !@images.empty? strip = Jani::StripMaker::Strip.new(index: index) until @images.empty? || strip.big_enough? strip.append_frame(@images.shift) end strips << strip index = index + 1 next end end end |