Class: Monet::Capture
- Inherits:
-
Object
- Object
- Monet::Capture
- Includes:
- Capybara::DSL
- Defined in:
- lib/monet/capture.rb
Constant Summary collapse
- MAX_HEIGHT =
10000
Instance Method Summary collapse
- #capture(path) ⇒ Object
- #capture_all ⇒ Object
-
#initialize(config) ⇒ Capture
constructor
A new instance of Capture.
Constructor Details
#initialize(config) ⇒ Capture
Returns a new instance of Capture.
13 14 15 16 17 18 |
# File 'lib/monet/capture.rb', line 13 def initialize(config) @config = Monet::Config.build_config(config) @router = Monet::PathRouter.new(@config) .default_driver = @config.driver end |
Instance Method Details
#capture(path) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/monet/capture.rb', line 26 def capture(path) visit @router.build_url(path) @config.dimensions.each do |width| page.driver.resize(width, MAX_HEIGHT) page.driver.render(@router.route_url_path(path, width), full: true) end end |
#capture_all ⇒ Object
20 21 22 23 24 |
# File 'lib/monet/capture.rb', line 20 def capture_all @config.map.paths.each do |path| capture(path) end end |