Module: Enum
- Defined in:
- lib/abstractivator/enum.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(_opts = {}) ⇒ Object
- #initialize(value) ⇒ Object
- #inspect ⇒ Object (also: #to_s)
- #to_json ⇒ Object
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/abstractivator/enum.rb', line 7 def value @value end |
Class Method Details
.included(base) ⇒ Object
26 27 28 |
# File 'lib/abstractivator/enum.rb', line 26 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#as_json(_opts = {}) ⇒ Object
18 19 20 |
# File 'lib/abstractivator/enum.rb', line 18 def as_json(_opts={}) value.as_json end |
#initialize(value) ⇒ Object
9 10 11 |
# File 'lib/abstractivator/enum.rb', line 9 def initialize(value) @value = value end |
#inspect ⇒ Object Also known as: to_s
13 14 15 |
# File 'lib/abstractivator/enum.rb', line 13 def inspect "#<#{self.class.name} #{value.inspect}>" end |
#to_json ⇒ Object
22 23 24 |
# File 'lib/abstractivator/enum.rb', line 22 def to_json value.to_json end |