Class: Zmeygo::Configuration
- Inherits:
-
Object
- Object
- Zmeygo::Configuration
- Defined in:
- lib/zmeygo/configuration.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#default_project ⇒ Object
Returns the value of attribute default_project.
-
#locale_dir ⇒ Object
Returns the value of attribute locale_dir.
-
#server ⇒ Object
Returns the value of attribute server.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/zmeygo/configuration.rb', line 10 def initialize src_file = File.join(File.dirname(__FILE__),'../..','templates','zmeygo.yml.template') dest_dir = File.dirname(File.(Constant::DEFAULT_CONFIG_FILE)) dest_file = File.(Constant::DEFAULT_CONFIG_FILE) unless File.exists?(dest_file) puts "making folder #{dest_dir}" FileUtils.mkdir dest_dir system "cp #{src_file} #{dest_file}" end conf_all = YAML.load_file(File.(dest_file)) #TODO: change env to vailue of either RAILS_ENV, RACK_ENV or ZMEYGO_ENV env = 'development' conf = conf_all[env] self.server = conf['server'] self.api_token = conf['api_token'] self.locale_dir = conf['locale_dir'] self.default_project = conf['default_project'] end |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
8 9 10 |
# File 'lib/zmeygo/configuration.rb', line 8 def api_token @api_token end |
#default_project ⇒ Object
Returns the value of attribute default_project.
8 9 10 |
# File 'lib/zmeygo/configuration.rb', line 8 def default_project @default_project end |
#locale_dir ⇒ Object
Returns the value of attribute locale_dir.
8 9 10 |
# File 'lib/zmeygo/configuration.rb', line 8 def locale_dir @locale_dir end |
#server ⇒ Object
Returns the value of attribute server.
8 9 10 |
# File 'lib/zmeygo/configuration.rb', line 8 def server @server end |
Instance Method Details
#[](key) ⇒ Object
33 34 35 36 37 |
# File 'lib/zmeygo/configuration.rb', line 33 def [](key) if self.respond_to?(key) send(key) end end |