Class: Capybara::Flow::GifAnimator
- Inherits:
-
Object
- Object
- Capybara::Flow::GifAnimator
- Defined in:
- lib/capybara/flow/gif_animator.rb
Instance Attribute Summary collapse
-
#delay ⇒ Object
readonly
Returns the value of attribute delay.
-
#frames ⇒ Object
readonly
Returns the value of attribute frames.
-
#iterations ⇒ Object
readonly
Returns the value of attribute iterations.
-
#output_file ⇒ Object
readonly
Returns the value of attribute output_file.
Instance Method Summary collapse
- #add(frame) ⇒ Object
- #generate! ⇒ Object
-
#initialize(output_file, options = {}) ⇒ GifAnimator
constructor
A new instance of GifAnimator.
Constructor Details
#initialize(output_file, options = {}) ⇒ GifAnimator
8 9 10 11 12 13 |
# File 'lib/capybara/flow/gif_animator.rb', line 8 def initialize(output_file, = {}) @delay = [:delay_in_ms] @iterations = [:iterations] @output_file = output_file @frames = [] end |
Instance Attribute Details
#delay ⇒ Object (readonly)
Returns the value of attribute delay.
6 7 8 |
# File 'lib/capybara/flow/gif_animator.rb', line 6 def delay @delay end |
#frames ⇒ Object (readonly)
Returns the value of attribute frames.
6 7 8 |
# File 'lib/capybara/flow/gif_animator.rb', line 6 def frames @frames end |
#iterations ⇒ Object (readonly)
Returns the value of attribute iterations.
6 7 8 |
# File 'lib/capybara/flow/gif_animator.rb', line 6 def iterations @iterations end |
#output_file ⇒ Object (readonly)
Returns the value of attribute output_file.
6 7 8 |
# File 'lib/capybara/flow/gif_animator.rb', line 6 def output_file @output_file end |
Instance Method Details
#add(frame) ⇒ Object
15 16 17 |
# File 'lib/capybara/flow/gif_animator.rb', line 15 def add(frame) frames << frame end |
#generate! ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/capybara/flow/gif_animator.rb', line 19 def generate! gif = ::Magick::ImageList.new(*frames) gif.delay = delay if delay gif.iterations = iterations if iterations gif.ticks_per_second = 1000 gif.write(output_file) end |