Class: Crowbar::Client::Config
- Inherits:
-
Object
- Object
- Crowbar::Client::Config
- Includes:
- Singleton
- Defined in:
- lib/crowbar/client/config.rb
Instance Attribute Summary collapse
Class Method Summary collapse
- .config ⇒ Object
- .configure(options) ⇒ Object
- .defaults ⇒ Object
- .method_missing(method, *arguments, &block) ⇒ Object
- .options ⇒ Object
- .respond_to?(method, include_private = false) ⇒ Boolean
- .values ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#config ⇒ Object
55 56 57 |
# File 'lib/crowbar/client/config.rb', line 55 def config @config ||= Hashie::Mash.new end |
#options ⇒ Object
51 52 53 |
# File 'lib/crowbar/client/config.rb', line 51 def ||= defaults end |
#values ⇒ Object
59 60 61 |
# File 'lib/crowbar/client/config.rb', line 59 def values @values ||= Hashie::Mash.new end |
Class Method Details
.config ⇒ Object
178 179 180 |
# File 'lib/crowbar/client/config.rb', line 178 def config instance.config end |
.configure(options) ⇒ Object
166 167 168 |
# File 'lib/crowbar/client/config.rb', line 166 def configure() instance.configure() end |
.defaults ⇒ Object
170 171 172 |
# File 'lib/crowbar/client/config.rb', line 170 def defaults instance.defaults end |
.method_missing(method, *arguments, &block) ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/crowbar/client/config.rb', line 186 def method_missing(method, *arguments, &block) case when method.to_s.ends_with?("=") key = method.to_s.gsub(/=\z/, "") if values.key?(key) values[key] = arguments.first else super end when values.key?(method) values[method] else super end end |
.options ⇒ Object
174 175 176 |
# File 'lib/crowbar/client/config.rb', line 174 def instance. end |
.respond_to?(method, include_private = false) ⇒ Boolean
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/crowbar/client/config.rb', line 203 def respond_to?(method, include_private = false) case when method.to_s.ends_with?("=") key = method.to_s.gsub(/=\z/, "") if values.key?(key) true else super end when values.key?(method) true else super end end |
.values ⇒ Object
182 183 184 |
# File 'lib/crowbar/client/config.rb', line 182 def values instance.values end |
Instance Method Details
#configure(options) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/crowbar/client/config.rb', line 30 def configure() self. = Hashie::Mash.new( ) self.config = parser self.values = merge end |
#defaults ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/crowbar/client/config.rb', line 39 def defaults @defaults ||= Hashie::Mash.new( alias: default_alias, username: default_username, password: default_password, server: default_server, timeout: default_timeout, anonymous: default_anonymous, debug: default_debug ) end |