Class: Ghostbuster::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/ghostbuster/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path_to_file = nil) ⇒ Config

Returns a new instance of Config.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ghostbuster/config.rb', line 5

def initialize(path_to_file = nil)
  @config_file = path_to_file || './Ghostfile'
  @screenshot_x, @screenshot_y = 800, 2000
  @pattern = "./test_*.{coffee,js}"
  @phantom_bin = File.join(ENV['HOME'], '.ghostbuster', 'phantomjs')
  @screenshot_dir = "."
  @screenshots = true
  @verbose = false
  @temp_dir = "/tmp"
  @start_command, @stop_command = "./start.sh", "./stop.sh"
  @start_wait = 2
  if File.exist?(@config_file)
    instance_eval File.read(@config_file), @config_file, 1
  end
  @screenshot_dir = File.expand_path(@screenshot_dir)
end

Instance Attribute Details

#patternObject

Returns the value of attribute pattern.



3
4
5
# File 'lib/ghostbuster/config.rb', line 3

def pattern
  @pattern
end

#phantom_binObject

Returns the value of attribute phantom_bin.



3
4
5
# File 'lib/ghostbuster/config.rb', line 3

def phantom_bin
  @phantom_bin
end

#screenshot_dirObject

Returns the value of attribute screenshot_dir.



3
4
5
# File 'lib/ghostbuster/config.rb', line 3

def screenshot_dir
  @screenshot_dir
end

#screenshot_xObject (readonly)

Returns the value of attribute screenshot_x.



4
5
6
# File 'lib/ghostbuster/config.rb', line 4

def screenshot_x
  @screenshot_x
end

#screenshot_yObject (readonly)

Returns the value of attribute screenshot_y.



4
5
6
# File 'lib/ghostbuster/config.rb', line 4

def screenshot_y
  @screenshot_y
end

#start_commandObject

Returns the value of attribute start_command.



3
4
5
# File 'lib/ghostbuster/config.rb', line 3

def start_command
  @start_command
end

#start_waitObject

Returns the value of attribute start_wait.



3
4
5
# File 'lib/ghostbuster/config.rb', line 3

def start_wait
  @start_wait
end

#stop_commandObject

Returns the value of attribute stop_command.



3
4
5
# File 'lib/ghostbuster/config.rb', line 3

def stop_command
  @stop_command
end

#temp_dirObject

Returns the value of attribute temp_dir.



3
4
5
# File 'lib/ghostbuster/config.rb', line 3

def temp_dir
  @temp_dir
end

#verboseObject

Returns the value of attribute verbose.



3
4
5
# File 'lib/ghostbuster/config.rb', line 3

def verbose
  @verbose
end

Instance Method Details

#do_not_take_screenshots!Object



30
31
32
# File 'lib/ghostbuster/config.rb', line 30

def do_not_take_screenshots!
  @screenshots = false
end

#ghostObject



22
23
24
# File 'lib/ghostbuster/config.rb', line 22

def ghost
  self
end

#screenshot_dimensions(x, y) ⇒ Object



26
27
28
# File 'lib/ghostbuster/config.rb', line 26

def screenshot_dimensions(x, y)
  @screenshot_x, @screenshot_y = x, y
end

#screenshots?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/ghostbuster/config.rb', line 38

def screenshots?
  @screenshots
end

#take_screenshots!Object



34
35
36
# File 'lib/ghostbuster/config.rb', line 34

def take_screenshots!
  @screenshots = true
end