Module: Enum

Defined in:
lib/abstractivator/enum.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#valueObject (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

#inspectObject Also known as: to_s



13
14
15
# File 'lib/abstractivator/enum.rb', line 13

def inspect
  "#<#{self.class.name} #{value.inspect}>"
end

#to_jsonObject



22
23
24
# File 'lib/abstractivator/enum.rb', line 22

def to_json
  value.to_json
end