Class: Browserly::Screenshot

Inherits:
Object
  • Object
show all
Extended by:
Comandor
Defined in:
lib/browserly/screenshot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, selector = '') ⇒ Screenshot



9
10
11
12
13
14
# File 'lib/browserly/screenshot.rb', line 9

def initialize(url, selector = '')
  @url = url
  @pool = Browserly::Pool.instance
  @browser = pool.take_browser
  @selector = selector
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



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

def browser
  @browser
end

#fileObject (readonly)

Returns the value of attribute file.



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

def file
  @file
end

#poolObject (readonly)

Returns the value of attribute pool.



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

def pool
  @pool
end

#selectorObject (readonly)

Returns the value of attribute selector.



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

def selector
  @selector
end

Instance Method Details

#performObject



16
17
18
# File 'lib/browserly/screenshot.rb', line 16

def perform
  take_screenshot! && release_browser!
end