Class: CaptureOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/wraith/helpers/capture_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, wraith) ⇒ CaptureOptions

Returns a new instance of CaptureOptions.



7
8
9
10
# File 'lib/wraith/helpers/capture_options.rb', line 7

def initialize(options, wraith)
  @options = options
  @wraith = wraith
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/wraith/helpers/capture_options.rb', line 5

def options
  @options
end

#wraithObject (readonly)

Returns the value of attribute wraith.



5
6
7
# File 'lib/wraith/helpers/capture_options.rb', line 5

def wraith
  @wraith
end

Instance Method Details

#base_urlObject



33
34
35
# File 'lib/wraith/helpers/capture_options.rb', line 33

def base_url
  base_urls(path)
end

#base_urls(path) ⇒ Object



41
42
43
# File 'lib/wraith/helpers/capture_options.rb', line 41

def base_urls(path)
  wraith.base_domain + path unless wraith.base_domain.nil?
end

#before_captureObject



29
30
31
# File 'lib/wraith/helpers/capture_options.rb', line 29

def before_capture
  options["before_capture"] ? convert_to_absolute(options["before_capture"]) : false
end

#casper?(options) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/wraith/helpers/capture_options.rb', line 49

def casper?(options)
  options["path"] ? options["path"] : options
end

#compare_urlObject



37
38
39
# File 'lib/wraith/helpers/capture_options.rb', line 37

def compare_url
  compare_urls(path)
end

#compare_urls(path) ⇒ Object



45
46
47
# File 'lib/wraith/helpers/capture_options.rb', line 45

def compare_urls(path)
  wraith.comp_domain + path unless wraith.comp_domain.nil?
end

#pathObject



12
13
14
# File 'lib/wraith/helpers/capture_options.rb', line 12

def path
  casper?(options)
end

#resizeObject



20
21
22
23
24
25
26
27
# File 'lib/wraith/helpers/capture_options.rb', line 20

def resize
  # path level, or YAML-file level `resize_or_reload` property value
  if options["resize_or_reload"]
    (options["resize_or_reload"] == "resize")
  else
    wraith.resize
  end
end

#selectorObject



16
17
18
# File 'lib/wraith/helpers/capture_options.rb', line 16

def selector
  options["selector"] || "body"
end