Class: Stockboy::MappedRecord
- Inherits:
-
Object
- Object
- Stockboy::MappedRecord
- Defined in:
- lib/stockboy/mapped_record.rb
Overview
This represents the “output” side of a CandidateRecord
Based on the current attribute map, it will have reader methods for the output values of each attribute. This is similar to an OpenStruct, but more efficient since we cache the defined methods.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(fields) ⇒ MappedRecord
constructor
Initialize a new MappedRecord.
- #to_s ⇒ String
Constructor Details
#initialize(fields) ⇒ MappedRecord
Initialize a new MappedRecord
45 46 47 48 49 50 |
# File 'lib/stockboy/mapped_record.rb', line 45 def initialize(fields) mod = AccessorMethods.for(fields.keys) extend mod @fields = fields freeze end |
Instance Method Details
#to_s ⇒ String
54 55 56 |
# File 'lib/stockboy/mapped_record.rb', line 54 def to_s @fields.to_s end |