Class: Jani::StripMaker::Strip
- Inherits:
-
Object
- Object
- Jani::StripMaker::Strip
- Includes:
- Magick
- Defined in:
- lib/jani/strip_maker/strip.rb
Constant Summary collapse
- FILE_NAME_DIGITS =
4
- FILE_EXTENTION =
"jpg"
Instance Method Summary collapse
- #append_frame(frame_image) ⇒ Object
- #big_enough? ⇒ Boolean
- #image ⇒ Object
-
#initialize(images: [], index: 1) ⇒ Strip
constructor
A new instance of Strip.
- #to_metadata ⇒ Object
- #write(filename = nil) ⇒ Object
Constructor Details
#initialize(images: [], index: 1) ⇒ Strip
Returns a new instance of Strip.
9 10 11 12 |
# File 'lib/jani/strip_maker/strip.rb', line 9 def initialize(images:[] , index: 1) @frame_images = images.dup @index = index end |
Instance Method Details
#append_frame(frame_image) ⇒ Object
28 29 30 |
# File 'lib/jani/strip_maker/strip.rb', line 28 def append_frame(frame_image) @frame_images << frame_image end |
#big_enough? ⇒ Boolean
14 15 16 17 |
# File 'lib/jani/strip_maker/strip.rb', line 14 def big_enough? return false if frames_count.zero? pixels / frames_count * (frames_count + 1.0) > Jani::StripMaker::MAX_PIXELS_FOR_MOBILE_SAFARI end |
#image ⇒ Object
24 25 26 |
# File 'lib/jani/strip_maker/strip.rb', line 24 def image to_rmagic_image_list.append(true) end |
#to_metadata ⇒ Object
32 33 34 35 36 37 |
# File 'lib/jani/strip_maker/strip.rb', line 32 def { index: @index, frames_count: frames_count } end |
#write(filename = nil) ⇒ Object
19 20 21 22 |
# File 'lib/jani/strip_maker/strip.rb', line 19 def write(filename = nil) name = filename || filename() image().write(name) end |