class Zashoku::Item

Attributes

attr[RW]

Public Class Methods

new(attributes) click to toggle source
# File lib/core/item.rb, line 6
def initialize(attributes)
  @attributes = attributes
  keys = []
  @attr = attributes.map { |k, v|
    pk = k.to_s.chars.map { |c| [c, c.swapcase] }.flatten
    kc = 0
    kc += 1 while kc < pk.length && keys.include?(pk[kc])
    keys << pk[kc]
    [pk[kc], v]
  }.to_h
end

Public Instance Methods

method_missing(m, *args, &block) click to toggle source
Calls superclass method
# File lib/core/item.rb, line 18
def method_missing(m, *args, &block)
  return @attributes[m.to_s] if @attributes.key?(m.to_s)
  #raise "error #{m} not found"
  super
end