Class: Simulacrum::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/simulacrum/configuration.rb

Overview

Configuration Class for managing config of the suite

Constant Summary collapse

COMPONENT_DEFAULTS =
{
  delta_threshold:  1,
  window_size:      [1024, 768],
  capture_delay:    nil,
  capture_selector: :html
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



18
19
20
# File 'lib/simulacrum/configuration.rb', line 18

def initialize
  @config = OpenStruct.new(component: OpenStruct.new(COMPONENT_DEFAULTS))
end

Instance Attribute Details

#candidate_filenameObject (readonly)

Returns the value of attribute candidate_filename.



14
15
16
# File 'lib/simulacrum/configuration.rb', line 14

def candidate_filename
  @candidate_filename
end

#capture_delayObject (readonly)

Returns the value of attribute capture_delay.



14
15
16
# File 'lib/simulacrum/configuration.rb', line 14

def capture_delay
  @capture_delay
end

#capture_selectorObject (readonly)

Returns the value of attribute capture_selector.



14
15
16
# File 'lib/simulacrum/configuration.rb', line 14

def capture_selector
  @capture_selector
end

#default_browserObject (readonly)

Returns the value of attribute default_browser.



14
15
16
# File 'lib/simulacrum/configuration.rb', line 14

def default_browser
  @default_browser
end

#delta_thresholdObject (readonly)

Returns the value of attribute delta_threshold.



14
15
16
# File 'lib/simulacrum/configuration.rb', line 14

def delta_threshold
  @delta_threshold
end

#diff_filenameObject (readonly)

Returns the value of attribute diff_filename.



14
15
16
# File 'lib/simulacrum/configuration.rb', line 14

def diff_filename
  @diff_filename
end

#reference_filenameObject (readonly)

Returns the value of attribute reference_filename.



14
15
16
# File 'lib/simulacrum/configuration.rb', line 14

def reference_filename
  @reference_filename
end

#references_pathObject (readonly)

Returns the value of attribute references_path.



14
15
16
# File 'lib/simulacrum/configuration.rb', line 14

def references_path
  @references_path
end

#window_sizeObject (readonly)

Returns the value of attribute window_size.



14
15
16
# File 'lib/simulacrum/configuration.rb', line 14

def window_size
  @window_size
end

Instance Method Details

#build_nameObject



56
57
58
# File 'lib/simulacrum/configuration.rb', line 56

def build_name
  @config.build_name || ''
end

#configure(config) ⇒ Object



22
23
24
# File 'lib/simulacrum/configuration.rb', line 22

def configure(config)
  @config = OpenStruct.new(@config.to_h.merge!(config))
end

#project_nameObject



60
61
62
# File 'lib/simulacrum/configuration.rb', line 60

def project_name
  @config.project_name || 'Simulacrum'
end