Module: Ruby::Enum
- Defined in:
- lib/ruby-enum/enum.rb,
lib/ruby-enum/version.rb,
lib/ruby-enum/enum/case.rb,
lib/ruby-enum/errors/base.rb,
lib/ruby-enum/enum/i18n_mock.rb,
lib/ruby-enum/errors/duplicate_key_error.rb,
lib/ruby-enum/errors/duplicate_value_error.rb,
lib/ruby-enum/errors/uninitialized_constant_error.rb
Defined Under Namespace
Modules: Case, ClassMethods, Errors, I18nMock
Constant Summary collapse
- VERSION =
'1.0.0'
Class Attribute Summary collapse
-
.i18n ⇒ Object
Needed for I18n mock.
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.i18n ⇒ Object
Needed for I18n mock
7 8 9 |
# File 'lib/ruby-enum/enum.rb', line 7 def i18n @i18n end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
10 11 12 |
# File 'lib/ruby-enum/enum.rb', line 10 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
10 11 12 |
# File 'lib/ruby-enum/enum.rb', line 10 def value @value end |
Class Method Details
.included(base) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/ruby-enum/enum.rb', line 17 def self.included(base) base.extend Enumerable base.extend ClassMethods base.private_class_method(:new) end |
Instance Method Details
#initialize(key, value) ⇒ Object
12 13 14 15 |
# File 'lib/ruby-enum/enum.rb', line 12 def initialize(key, value) @key = key @value = value end |