class Stockboy::MappedRecord

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.

@example

output = MappedRecord.new(first_name: "Zaphod")
output.first_name # => "Zaphod"

Public Class Methods

new(fields) click to toggle source

Initialize a new MappedRecord

@param [Hash<Symbol>] fields

Keys map to reader methods
# File lib/stockboy/mapped_record.rb, line 45
def initialize(fields)
  mod = AccessorMethods.for(fields.keys)
  extend mod
  @fields = fields
  freeze
end