lib/gnawrnip.rb in gnawrnip-0.1.3 vs lib/gnawrnip.rb in gnawrnip-0.2.0
- old
+ new
@@ -1,48 +1,65 @@
require "gnawrnip/version"
require 'gnawrnip/rspec'
require 'gnawrnip/photographer'
-require 'gnawrnip/step_screenshot'
+require 'gnawrnip/publisher'
module Gnawrnip
class << self
- attr_accessor :publisher_driver
+ #
+ # [Integer] Time (millisecond) between each image in animation
+ #
attr_accessor :frame_interval
- attr_accessor :frame_size
+
+ #
+ # [Boolean] Whether to make animation GIF
+ #
attr_accessor :make_animation
+ #
+ # [Integer] Maximum size that use to resize of image.
+ # If given, it resize the image to fit to this value.
+ # Ignored if this value is greater than original width and height.
+ #
+ # Example:
+ # original: 640x480
+ # this value: 300
+ # result : 300x225
+ #
+ # original: 480x640
+ # this value: 400
+ # result : 300x400
+ #
+ attr_accessor :max_frame_size
+
def configure
yield self
end
def ready!
require 'gnawrnip/ext/capybara/session' if animation?
- publisher
+ require 'gnawrnip/step_screenshot'
end
def animation?
make_animation
end
def photographer
- @photographer ||= Gnawrnip::Photographer.new
+ @photographer ||= Photographer.new
end
def publisher
- @publisher ||= case publisher_driver
- when :rmagick
- require 'gnawrnip/publisher/rmagick'
- @publisher = Publisher::RMagick.new
- else # :js
- require 'gnawrnip/publisher/js'
- @publisher = Publisher::JS.new
- end
+ @publisher ||= Publisher.new
end
+
+ def publisher_driver=(driver)
+ warn "DEPRECATED: `publisher_driver` option is deprecated (not used)."
+ end
end
end
Gnawrnip.configure do |c|
- c.publisher_driver = :js
- c.frame_interval = 1000
- c.frame_size = nil
- c.make_animation = true
+ c.frame_interval = 1000
+ c.make_animation = true
+ c.max_frame_size = nil
end