Class: Zucchini::Config
- Inherits:
-
Object
- Object
- Zucchini::Config
- Defined in:
- lib/config.rb
Class Method Summary collapse
- .app ⇒ Object
- .base_path ⇒ Object
- .base_path=(base_path) ⇒ Object
- .device(device_name) ⇒ Object
- .devices ⇒ Object
- .resolution_name(dimension) ⇒ Object
- .server(server_name) ⇒ Object
- .url(server_name, href = "") ⇒ Object
Class Method Details
.app ⇒ Object
15 16 17 |
# File 'lib/config.rb', line 15 def self.app @@config['app'] end |
.base_path ⇒ Object
6 7 8 |
# File 'lib/config.rb', line 6 def self.base_path @@base_path end |
.base_path=(base_path) ⇒ Object
10 11 12 13 |
# File 'lib/config.rb', line 10 def self.base_path=(base_path) @@base_path = base_path @@config = YAML::load_file("#{base_path}/support/config.yml") end |
.device(device_name) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/config.rb', line 27 def self.device(device_name) raise "Device not listed in config.yml" unless (device = devices[device_name]) { :name => device_name, :udid => device['UDID'], :screen => device['screen'] } end |
.devices ⇒ Object
23 24 25 |
# File 'lib/config.rb', line 23 def self.devices @@config['devices'] end |
.resolution_name(dimension) ⇒ Object
19 20 21 |
# File 'lib/config.rb', line 19 def self.resolution_name(dimension) @@config['resolutions'][dimension.to_i] end |
.server(server_name) ⇒ Object
36 37 38 |
# File 'lib/config.rb', line 36 def self.server(server_name) @@config['servers'][server_name] end |
.url(server_name, href = "") ⇒ Object
40 41 42 43 44 45 |
# File 'lib/config.rb', line 40 def self.url(server_name, href="") server_config = server(server_name) port = server_config['port'] ? ":#{server_config['port']}" : "" "http://#{server_config['host']}#{port}#{href}" end |