Class: SettingCrazy::Template::Enum
- Inherits:
-
Hash
- Object
- Hash
- SettingCrazy::Template::Enum
- Defined in:
- lib/settingcrazy/template/enum.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(name, options, &block) ⇒ Enum
constructor
A new instance of Enum.
- #value(enum_value, description = enum_value) ⇒ Object
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, , &block) super() @name = name @options = instance_eval(&block) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/settingcrazy/template/enum.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/settingcrazy/template/enum.rb', line 5 def @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 |