Class: ClowderCommonRuby::BrokerConfig
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- ClowderCommonRuby::BrokerConfig
- Defined in:
- lib/clowder-common-ruby/types.rb
Instance Method Summary collapse
-
#initialize(attributes) ⇒ BrokerConfig
constructor
A new instance of BrokerConfig.
- #valid_keys ⇒ Object
Constructor Details
#initialize(attributes) ⇒ BrokerConfig
Returns a new instance of BrokerConfig.
138 139 140 141 142 143 144 145 146 147 |
# File 'lib/clowder-common-ruby/types.rb', line 138 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
149 150 151 152 153 154 |
# File 'lib/clowder-common-ruby/types.rb', line 149 def valid_keys [].tap do |keys| keys << :hostname keys << :port end end |