Class: ClowderCommonRuby::InMemoryDBConfig
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- ClowderCommonRuby::InMemoryDBConfig
- Defined in:
- lib/clowder-common-ruby/types.rb
Instance Method Summary collapse
-
#initialize(attributes) ⇒ InMemoryDBConfig
constructor
A new instance of InMemoryDBConfig.
- #valid_keys ⇒ Object
Constructor Details
#initialize(attributes) ⇒ InMemoryDBConfig
Returns a new instance of InMemoryDBConfig.
282 283 284 285 286 287 288 289 290 291 |
# File 'lib/clowder-common-ruby/types.rb', line 282 def initialize(attributes) super raise 'The input argument (attributes) must be a hash' if (!attributes || !attributes.is_a?(Hash)) attributes = attributes.each_with_object({}) do |(k, v), h| raise "The input [#{k}] is invalid" unless valid_keys.include?(k.to_sym) h[k.to_sym] = v end end |
Instance Method Details
#valid_keys ⇒ Object
293 294 295 296 297 298 299 300 |
# File 'lib/clowder-common-ruby/types.rb', line 293 def valid_keys [].tap do |keys| keys << :hostname keys << :port keys << :username keys << :password end end |