class Kokkai::Record

Constants

DEFAULT_ATTRIBUTES

Attributes

raw[R]
raw_record[R]

Public Class Methods

define_attribute_methods(attrs) click to toggle source
# File lib/kokkai/record.rb, line 13
def define_attribute_methods(attrs)
  attrs.each do |attr|
    define_method(attr) do
      key = attr.to_s
      key = if key.match(/_url$/)
        key = key.split(/_url$/) { |s| s }.join() + ""
        key << "URL"
      else
        key.to_camel
      end
      @raw_record ? @raw_record[key] : nil
    end
    memoize attr
  end
end
new(raw) click to toggle source
# File lib/kokkai/record.rb, line 32
def initialize(raw)
  @raw = raw
  @raw_record = @raw.dig("recordData")
end