Class: GreenOnion::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#driverObject



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

def driver
  @driver ||= :webkit
end

#skins_dirObject



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

def skins_dir
  @skins_dir ||= './spec/skins'
end

#thresholdObject



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

def threshold
  @threshold ||= 100
end

Instance Method Details

#browserObject

Uses the driver and dimensions configuration vars to return a Browser object



27
28
29
30
31
32
# File 'lib/green_onion/configuration.rb', line 27

def browser
  @browser = Browser.new(
    :dimensions => dimensions,
    :driver => driver
  )
end

#dimensionsObject



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

def dimensions
  @dimensions ||= { :height => 768, :width => 1024 }
end

#dimensions=(options) ⇒ Object



6
7
8
# File 'lib/green_onion/configuration.rb', line 6

def dimensions=(options)
  @dimensions = options
end

#skin_nameObject



38
39
40
# File 'lib/green_onion/configuration.rb', line 38

def skin_name
  @skin_name ||= skin_namespace_hash
end

#skin_name=(options) ⇒ Object



34
35
36
# File 'lib/green_onion/configuration.rb', line 34

def skin_name=(options)
  @skin_name = skin_namespace_hash(options)
end

#skin_namespace_hash(options = {}) ⇒ Object

Serves as a template for skin_name getter/setter



43
44
45
46
47
48
49
50
# File 'lib/green_onion/configuration.rb', line 43

def skin_namespace_hash(options = {})
  { 
    :match   =>  options[:match] ? options[:match] : /[\/]/, 
    :replace =>  options[:replace] ? options[:replace] : "_", 
    :prefix  =>  options[:prefix] ? options[:prefix] : nil,
    :root    =>  options[:root] ? options[:root] : "root"
  }
end