class Capybara::Flow::GifAnimator

Attributes

delay[R]
frames[R]
iterations[R]
output_file[R]

Public Class Methods

new(output_file, options = {}) click to toggle source
# File lib/capybara/flow/gif_animator.rb, line 8
def initialize(output_file, options = {})
  @delay = options[:delay_in_ms]
  @iterations = options[:iterations]
  @output_file = output_file
  @frames = []
end

Public Instance Methods

add(frame) click to toggle source
# File lib/capybara/flow/gif_animator.rb, line 15
def add(frame)
  frames << frame
end
generate!() click to toggle source
# 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