class ClowderCommonRuby::KafkaConfig
Attributes
brokers[RW]
topics[RW]
Public Class Methods
new(attributes)
click to toggle source
Calls superclass method
# File lib/clowder-common-ruby/types.rb, line 109 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 @brokers = [] attributes.fetch(:brokers, []).each do |attr| @brokers << BrokerConfig.new(attr) end @topics = [] attributes.fetch(:topics, []).each do |attr| @topics << TopicConfig.new(attr) end end
Public Instance Methods
valid_keys()
click to toggle source
# File lib/clowder-common-ruby/types.rb, line 128 def valid_keys [].tap do |keys| keys << :brokers keys << :topics end end