Sha256: 68f8dec7886eeadb8455cf9d5edc61a3e210c76d95a49b1c887f54e7ba0f2e0c
Contents?: true
Size: 651 Bytes
Versions: 31
Compression:
Stored size: 651 Bytes
Contents
module Marty::PgEnum def [](index) index = index.to_s raise "no such #{self.name}: '#{index}'" unless self::VALUES.include?(index) StringEnum.new(index) end def get_all self::VALUES.map { |v| StringEnum.new(v) } end GET_ALL_SIG = [0, 0] LOOKUP_SIG = [1, 1] FIND_BY_NAME_SIG = [1, 1] def self.extended(base) base.class_eval do const_set :GET_ALL_SIG, Marty::PgEnum::GET_ALL_SIG const_set :LOOKUP_SIG, Marty::PgEnum::LOOKUP_SIG const_set :FIND_BY_NAME_SIG, Marty::PgEnum::FIND_BY_NAME_SIG end end def seed end alias_method :find_by_name, :[] alias_method :lookup, :[] end
Version data entries
31 entries across 31 versions & 1 rubygems