Module: CouchRestAdapter::DbConfig::ClassMethods
- Defined in:
- lib/couch_rest_adapter/db_config.rb
Instance Attribute Summary collapse
-
#config_file ⇒ Object
Returns the value of attribute config_file.
Instance Method Summary collapse
- #auth_info(parts) ⇒ Object
- #base_path ⇒ Object
- #default_design_doc ⇒ Object
- #full_path ⇒ Object
- #parse_config ⇒ Object
Instance Attribute Details
#config_file ⇒ Object
Returns the value of attribute config_file.
8 9 10 |
# File 'lib/couch_rest_adapter/db_config.rb', line 8 def config_file @config_file end |
Instance Method Details
#auth_info(parts) ⇒ Object
14 15 16 17 |
# File 'lib/couch_rest_adapter/db_config.rb', line 14 def auth_info parts return "" unless parts['username'].present? "#{parts['username']}:#{parts['password']}@" end |
#base_path ⇒ Object
19 20 21 22 |
# File 'lib/couch_rest_adapter/db_config.rb', line 19 def base_path parts = parse_config[Rails.env] "#{parts['protocol']}://#{auth_info parts}#{parts['host']}:#{parts['port']}" end |
#default_design_doc ⇒ Object
33 34 35 |
# File 'lib/couch_rest_adapter/db_config.rb', line 33 def default_design_doc parse_config[Rails.env]['design_doc'] end |
#full_path ⇒ Object
24 25 26 |
# File 'lib/couch_rest_adapter/db_config.rb', line 24 def full_path "#{base_path}/#{parse_config[Rails.env]['name']}" end |
#parse_config ⇒ Object
10 11 12 |
# File 'lib/couch_rest_adapter/db_config.rb', line 10 def parse_config YAML::load( ERB.new( File.read(config_file) ).result) end |