Module: CouchRest::Changes::Config
Instance Attribute Summary collapse
- #app_name ⇒ Object
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#log_file ⇒ Object
Returns the value of attribute log_file.
-
#log_level ⇒ Object
writeonly
Sets the attribute log_level.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#options ⇒ Object
Returns the value of attribute options.
-
#seq_file ⇒ Object
Returns the value of attribute seq_file.
Instance Method Summary collapse
- #complete_db_name(db_name) ⇒ Object
- #couch_host(conf = nil) ⇒ Object
- #couch_host_without_password ⇒ Object
- #load(base_dir, *configs) ⇒ Object
Instance Attribute Details
#app_name ⇒ Object
48 49 50 |
# File 'lib/couchrest/changes/config.rb', line 48 def app_name @app_name ||= Pathname.new($0).basename.to_s end |
#connection ⇒ Object
Returns the value of attribute connection.
9 10 11 |
# File 'lib/couchrest/changes/config.rb', line 9 def connection @connection end |
#flags ⇒ Object
Returns the value of attribute flags.
15 16 17 |
# File 'lib/couchrest/changes/config.rb', line 15 def flags @flags end |
#log_file ⇒ Object
Returns the value of attribute log_file.
11 12 13 |
# File 'lib/couchrest/changes/config.rb', line 11 def log_file @log_file end |
#log_level=(value) ⇒ Object
Sets the attribute log_level
12 13 14 |
# File 'lib/couchrest/changes/config.rb', line 12 def log_level=(value) @log_level = value end |
#logger ⇒ Object
Returns the value of attribute logger.
13 14 15 |
# File 'lib/couchrest/changes/config.rb', line 13 def logger @logger end |
#options ⇒ Object
Returns the value of attribute options.
14 15 16 |
# File 'lib/couchrest/changes/config.rb', line 14 def @options end |
#seq_file ⇒ Object
Returns the value of attribute seq_file.
10 11 12 |
# File 'lib/couchrest/changes/config.rb', line 10 def seq_file @seq_file end |
Instance Method Details
#complete_db_name(db_name) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/couchrest/changes/config.rb', line 41 def complete_db_name(db_name) [connection[:prefix], db_name, connection[:suffix]]. compact. reject{|part| part == ""}. join('_') end |
#couch_host(conf = nil) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/couchrest/changes/config.rb', line 30 def couch_host(conf = nil) conf ||= connection userinfo = [conf[:username], conf[:password]].compact.join(':') userinfo += '@' unless userinfo.empty? "#{conf[:protocol]}://#{userinfo}#{conf[:host]}:#{conf[:port]}" end |
#couch_host_without_password ⇒ Object
37 38 39 |
# File 'lib/couchrest/changes/config.rb', line 37 def couch_host_without_password couch_host connection.merge({:password => nil}) end |
#load(base_dir, *configs) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/couchrest/changes/config.rb', line 17 def load(base_dir, *configs) @base_dir = Pathname.new(base_dir) loaded = configs.collect do |file_path| file = find_file(file_path) load_config(file) end self.flags ||= [] init_logger log_loaded_configs(loaded.compact) logger.info "Observing #{couch_host_without_password}" return self end |