module CircuitPatchTools::AttrLookup

Public Instance Methods

attr_lookup(ext, int, table) click to toggle source
# File lib/circuit_patch_tools/attr_lookup.rb, line 3
def attr_lookup(ext, int, table)
  define_method ext do
    table.fetch(send(int))
  end

  define_method "#{ext}=" do |v|
    send "#{int}=", table.index(v)
  end
end