Class: Snapcrawl::Screenshot

Inherits:
Object
  • Object
show all
Defined in:
lib/snapcrawl/screenshot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Screenshot

Returns a new instance of Screenshot.



9
10
11
# File 'lib/snapcrawl/screenshot.rb', line 9

def initialize(url)
  @url = url
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/snapcrawl/screenshot.rb', line 7

def url
  @url
end

Instance Method Details

#save(outfile = nil) ⇒ Object



13
14
15
16
# File 'lib/snapcrawl/screenshot.rb', line 13

def save(outfile = nil)
  outfile ||= "#{url.to_slug}.png"
  webshot_capture url, outfile
end