Class: ApiConfiguration
- Inherits:
-
Object
- Object
- ApiConfiguration
- Defined in:
- lib/api_configuration.rb
Instance Attribute Summary collapse
-
#csv_mode ⇒ Object
Returns the value of attribute csv_mode.
-
#host ⇒ Object
Returns the value of attribute host.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#port ⇒ Object
Returns the value of attribute port.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#substitution ⇒ Object
Returns the value of attribute substitution.
-
#verbosity ⇒ Object
Returns the value of attribute verbosity.
Instance Method Summary collapse
-
#initialize(raw_config, env) ⇒ ApiConfiguration
constructor
initializes a configuration object from given YAML file for given environment.
Constructor Details
#initialize(raw_config, env) ⇒ ApiConfiguration
initializes a configuration object from given YAML file for given environment
6 7 8 9 10 11 12 13 |
# File 'lib/api_configuration.rb', line 6 def initialize(raw_config, env) raw_config[env.to_s].each { |key, value| self.instance_variable_set("@#{key}", value) } self.verbosity = raw_config['general']['verbosity'].first self.priority = raw_config['general']['priority'] || 0 self.substitution = raw_config['general']['substitution'] self.csv_mode = raw_config['general']['csv_mode'].first rescue "none" self end |
Instance Attribute Details
#csv_mode ⇒ Object
Returns the value of attribute csv_mode.
3 4 5 |
# File 'lib/api_configuration.rb', line 3 def csv_mode @csv_mode end |
#host ⇒ Object
Returns the value of attribute host.
3 4 5 |
# File 'lib/api_configuration.rb', line 3 def host @host end |
#namespace ⇒ Object
Returns the value of attribute namespace.
3 4 5 |
# File 'lib/api_configuration.rb', line 3 def namespace @namespace end |
#port ⇒ Object
Returns the value of attribute port.
3 4 5 |
# File 'lib/api_configuration.rb', line 3 def port @port end |
#priority ⇒ Object
Returns the value of attribute priority.
3 4 5 |
# File 'lib/api_configuration.rb', line 3 def priority @priority end |
#protocol ⇒ Object
Returns the value of attribute protocol.
3 4 5 |
# File 'lib/api_configuration.rb', line 3 def protocol @protocol end |
#substitution ⇒ Object
Returns the value of attribute substitution.
3 4 5 |
# File 'lib/api_configuration.rb', line 3 def substitution @substitution end |
#verbosity ⇒ Object
Returns the value of attribute verbosity.
3 4 5 |
# File 'lib/api_configuration.rb', line 3 def verbosity @verbosity end |