Class: Rmpd::MultiResponse
- Defined in:
- lib/rmpd/response.rb
Constant Summary
Constants inherited from Response
Response::KEY_VALUE_RE, Response::KNOWN_COMPLEX_FIELDS, Response::KNOWN_FLOAT_FIELDS, Response::KNOWN_INT_FIELDS, Response::MULTI_RESPONSE_COMMANDS
Instance Attribute Summary
Attributes inherited from Response
Instance Method Summary collapse
-
#initialize ⇒ MultiResponse
constructor
A new instance of MultiResponse.
- #parse(lines) ⇒ Object
- #register_key_val_pair(match_data) ⇒ Object
Methods inherited from Response
#ack?, choose_strategy, factory, #marshal_dump, #marshal_load, #ok?
Constructor Details
#initialize ⇒ MultiResponse
Returns a new instance of MultiResponse.
141 142 143 |
# File 'lib/rmpd/response.rb', line 141 def initialize super([]) end |
Instance Method Details
#parse(lines) ⇒ Object
145 146 147 148 149 150 151 152 |
# File 'lib/rmpd/response.rb', line 145 def parse(lines) @first_key = nil @temp = NilHash.new super(lines) self << @temp unless @temp.empty? self end |
#register_key_val_pair(match_data) ⇒ Object
154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/rmpd/response.rb', line 154 def register_key_val_pair(match_data) key = match_data[1].downcase val = transform_value(key, match_data[2]) if @first_key == key self << @temp @temp = NilHash.new({key => val}) else @first_key ||= key @temp[key] = val end define_getter(key, @temp) unless respond_to?(key) end |