Class: EndecaOnDemand::Response::RecordsSet::Record
- Includes:
- PP
- Defined in:
- lib/endeca_on_demand/response/records_set/record.rb
Instance Attribute Summary collapse
-
#properties ⇒ Object
readonly
associations ##.
-
#records_set ⇒ Object
readonly
fields ##.
Attributes inherited from Proxy
Instance Method Summary collapse
-
#class ⇒ Object
override proxy ##.
-
#initialize(records_set, xml) ⇒ Record
constructor
A new instance of Record.
- #inspect_attributes ⇒ Object
-
#keys ⇒ Object
data ##.
- #serializable_hash ⇒ Object (also: #to_hash)
Methods included from PP
Methods inherited from Proxy
Constructor Details
#initialize(records_set, xml) ⇒ Record
Returns a new instance of Record.
14 15 16 17 18 |
# File 'lib/endeca_on_demand/response/records_set/record.rb', line 14 def initialize(records_set, xml) @records_set, @xml = records_set, xml define_getters(:serializable_hash) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (protected)
55 56 57 58 59 |
# File 'lib/endeca_on_demand/response/records_set/record.rb', line 55 def method_missing(method, *args, &block) super(method, *args, &block) rescue NoMethodError '' end |
Instance Attribute Details
#properties ⇒ Object (readonly)
associations ##
12 13 14 |
# File 'lib/endeca_on_demand/response/records_set/record.rb', line 12 def properties @properties end |
#records_set ⇒ Object (readonly)
fields ##
12 13 14 |
# File 'lib/endeca_on_demand/response/records_set/record.rb', line 12 def records_set @records_set end |
Instance Method Details
#class ⇒ Object
override proxy ##
22 23 24 |
# File 'lib/endeca_on_demand/response/records_set/record.rb', line 22 def class EndecaOnDemand::Response::RecordsSet::Record end |
#inspect_attributes ⇒ Object
8 |
# File 'lib/endeca_on_demand/response/records_set/record.rb', line 8 def inspect_attributes; [ :properties ]; end |
#keys ⇒ Object
data ##
38 39 40 |
# File 'lib/endeca_on_demand/response/records_set/record.rb', line 38 def keys properties.map { |property| property.name } end |
#serializable_hash ⇒ Object Also known as: to_hash
42 43 44 45 46 47 48 |
# File 'lib/endeca_on_demand/response/records_set/record.rb', line 42 def serializable_hash properties.inject({}) do |hash,property| hash.tap do hash.has_key?(property.label) ? (hash[property.label] = [*hash[property.label]].push(property.value)) : (hash[property.label] = property.value) end end.symbolize_keys end |