Class: PolymorphicEnumType::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/polymorphic_enum_type/config.rb

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



5
6
7
# File 'lib/polymorphic_enum_type/config.rb', line 5

def initialize
  @h = {}
end

Instance Method Details

#add(attr, hash) ⇒ Object



9
10
11
# File 'lib/polymorphic_enum_type/config.rb', line 9

def add(attr, hash)
  h[attr.to_sym] = hash
end

#enum_hash(attr) ⇒ Object



13
14
15
# File 'lib/polymorphic_enum_type/config.rb', line 13

def enum_hash(attr)
  h.fetch(attr.to_sym).invert
end