Class: SettingCrazy::Template::Enum

Inherits:
Hash
  • Object
show all
Defined in:
lib/settingcrazy/template/enum.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options, &block) ⇒ Enum

Returns a new instance of Enum.



7
8
9
10
11
12
# File 'lib/settingcrazy/template/enum.rb', line 7

def initialize(name, options, &block)
  super()
  @name    = name
  @options = options
  instance_eval(&block)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/settingcrazy/template/enum.rb', line 5

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/settingcrazy/template/enum.rb', line 5

def options
  @options
end

Instance Method Details

#value(enum_value, description = enum_value) ⇒ Object



14
15
16
# File 'lib/settingcrazy/template/enum.rb', line 14

def value(enum_value, description = enum_value)
  self[description] = enum_value
end