Class: ClowderCommonRuby::ObjectStoreConfig
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- ClowderCommonRuby::ObjectStoreConfig
- Defined in:
- lib/clowder-common-ruby/types.rb
Instance Attribute Summary collapse
-
#buckets ⇒ Object
Returns the value of attribute buckets.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ ObjectStoreConfig
constructor
A new instance of ObjectStoreConfig.
- #valid_keys ⇒ Object
Constructor Details
#initialize(attributes) ⇒ ObjectStoreConfig
Returns a new instance of ObjectStoreConfig.
318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/clowder-common-ruby/types.rb', line 318 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| warn "The input [#{k}] is invalid" unless valid_keys.include?(k.to_sym) h[k.to_sym] = v end @buckets = [] attributes.fetch(:buckets, []).each do |attr| @buckets << ObjectStoreBucket.new(attr) end end |
Instance Attribute Details
#buckets ⇒ Object
Returns the value of attribute buckets.
316 317 318 |
# File 'lib/clowder-common-ruby/types.rb', line 316 def buckets @buckets end |
Instance Method Details
#valid_keys ⇒ Object
333 334 335 336 337 338 339 340 341 342 |
# File 'lib/clowder-common-ruby/types.rb', line 333 def valid_keys [].tap do |keys| keys << :buckets keys << :accessKey keys << :secretKey keys << :hostname keys << :port keys << :tls end end |