class FDIC::BankFind::Record

Attributes

attributes[R]

Public Class Methods

currency_field(method_name, response_key=method_name) click to toggle source
# File lib/fdic/bank_find/record.rb, line 23
def self.currency_field(method_name, response_key=method_name)
  field(method_name, response_key) { |value|
    value.to_f * 1000
  }
end
date_field(method_name, response_key=method_name) click to toggle source
# File lib/fdic/bank_find/record.rb, line 29
def self.date_field(method_name, response_key=method_name)
  field(method_name, response_key) { |value|
    Date.parse(value)
  }
end
field(method_name, response_key=method_name, &munger) click to toggle source
# File lib/fdic/bank_find/record.rb, line 11
def self.field(method_name, response_key=method_name, &munger)
  munger ||= lambda { |x| x }
  define_method(method_name) {
    value = attributes[response_key.to_s]
    value && munger.call(value)
  }
end
int_field(method_name, response_key=method_name) click to toggle source
# File lib/fdic/bank_find/record.rb, line 19
def self.int_field(method_name, response_key=method_name)
  field(method_name, response_key, &:to_i)
end
new(attributes) click to toggle source
# File lib/fdic/bank_find/record.rb, line 4
def initialize(attributes)
  @attributes = attributes
  @attributes.freeze
end