Module: Protoplasm::Types::ConstLookup::ClassMethods

Defined in:
lib/protoplasm/types/types.rb

Instance Method Summary collapse

Instance Method Details

#enum_mapObject



15
16
17
18
19
# File 'lib/protoplasm/types/types.rb', line 15

def enum_map
  @enum_map ||= begin
    constants.inject({}) { |h,k| h[const_get(k)] = k.to_sym; h }
  end
end

#lookup(val) ⇒ Object



11
12
13
# File 'lib/protoplasm/types/types.rb', line 11

def lookup(val)
  enum_map[val]
end