class Stockboy::SourceRecord

This represents the raw “input” side of a {CandidateRecord}

It provides access to the original field values before mapping or translation as hash keys.

@example

input = SourceRecord.new(
    {check_in: "2012-12-12"},
    {"RawCheckIn" => "2012-12-12"})

input["RawCheckIn"] # => "2012-12-12"
input.check_in # => "2012-12-12"

Public Class Methods

new(mapped_fields, data_fields) click to toggle source

Initialize a new instance

@param [Hash{Symbol=>Object}] mapped_fields

Represents the raw values mapped to the final attribute names

@param [Hash] data_fields

The raw input fields with original key values
Calls superclass method Stockboy::MappedRecord::new
# File lib/stockboy/source_record.rb, line 27
def initialize(mapped_fields, data_fields)
  @data_fields = data_fields
  super(mapped_fields)
end

Public Instance Methods

[](key) click to toggle source

Access a raw field value by the original input field name

@param [String] key

# File lib/stockboy/source_record.rb, line 36
def [](key)
  key = key.to_s if key.is_a? Symbol
  @data_fields[key]
end