Class: Pinot::ControllerResponse
- Inherits:
-
Object
- Object
- Pinot::ControllerResponse
- Defined in:
- lib/pinot/controller_response.rb
Instance Method Summary collapse
- #extract_broker_list ⇒ Object
- #extract_table_to_broker_map ⇒ Object
-
#initialize(raw_hash) ⇒ ControllerResponse
constructor
A new instance of ControllerResponse.
Constructor Details
#initialize(raw_hash) ⇒ ControllerResponse
Returns a new instance of ControllerResponse.
17 18 19 20 21 |
# File 'lib/pinot/controller_response.rb', line 17 def initialize(raw_hash) @data = raw_hash.transform_values do |brokers| brokers.map { |b| BrokerDto.new(b) } end end |
Instance Method Details
#extract_broker_list ⇒ Object
23 24 25 |
# File 'lib/pinot/controller_response.rb', line 23 def extract_broker_list @data.values.flatten.map(&:broker_address).uniq end |
#extract_table_to_broker_map ⇒ Object
27 28 29 |
# File 'lib/pinot/controller_response.rb', line 27 def extract_table_to_broker_map @data.transform_values { |brokers| brokers.map(&:broker_address) } end |