Class: ChemistryKit::Configuration

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

Overview

Default configuration class

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Configuration

Returns a new instance of Configuration.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/chemistrykit/configuration.rb', line 17

def initialize(hash)
  # set defaults
  @concurrency = 1
  @selenium_connect = {}
  @log = OpenStruct.new
  @log.path = 'evidence'
  @log.results_file = 'results_junit.xml'
  @log.format = 'JUnit'

  # overide with argument
  populate_with_hash hash
end

Instance Attribute Details

#base_urlObject

Returns the value of attribute base_url.



10
11
12
# File 'lib/chemistrykit/configuration.rb', line 10

def base_url
  @base_url
end

#concurrencyObject

Returns the value of attribute concurrency.



10
11
12
# File 'lib/chemistrykit/configuration.rb', line 10

def concurrency
  @concurrency
end

#logObject

Returns the value of attribute log.



13
14
15
# File 'lib/chemistrykit/configuration.rb', line 13

def log
  @log
end

#selenium_connectObject



37
38
39
40
41
42
43
44
# File 'lib/chemistrykit/configuration.rb', line 37

def selenium_connect
  # return the default log unless the sc log is set
  if @selenium_connect[:log].nil?
    @selenium_connect[:log] = @log.path
    return @selenium_connect
  end
  @selenium_connect
end

Class Method Details

.initialize_with_yaml(file) ⇒ Object



46
47
48
# File 'lib/chemistrykit/configuration.rb', line 46

def self.initialize_with_yaml(file)
  self.new symbolize_keys YAML.load_file file
end