Class: Deimos::SchemaClass::Enum
- Defined in:
- lib/deimos/schema_class/enum.rb
Overview
Base Class for Enum Classes generated from Avro.
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#as_json(_opts = {}) ⇒ Object
:nodoc:.
-
#initialize(value) ⇒ Enum
constructor
A new instance of Enum.
-
#symbols ⇒ Array<String>
Returns all the valid symbols for this enum.
- #to_s ⇒ String
Methods inherited from Base
Constructor Details
#initialize(value) ⇒ Enum
Returns a new instance of Enum.
24 25 26 |
# File 'lib/deimos/schema_class/enum.rb', line 24 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
11 12 13 |
# File 'lib/deimos/schema_class/enum.rb', line 11 def value @value end |
Class Method Details
.initialize_from_value(value) ⇒ Object
:nodoc:
40 41 42 43 44 |
# File 'lib/deimos/schema_class/enum.rb', line 40 def self.initialize_from_value(value) return nil if value.nil? value.is_a?(self) ? value : self.new(value) end |
Instance Method Details
#==(other) ⇒ Object
14 15 16 |
# File 'lib/deimos/schema_class/enum.rb', line 14 def ==(other) other.is_a?(self.class) ? other.value == @value : other == @value end |
#as_json(_opts = {}) ⇒ Object
:nodoc:
35 36 37 |
# File 'lib/deimos/schema_class/enum.rb', line 35 def as_json(_opts={}) @value end |
#symbols ⇒ Array<String>
Returns all the valid symbols for this enum.
30 31 32 |
# File 'lib/deimos/schema_class/enum.rb', line 30 def symbols raise NotImplementedError end |
#to_s ⇒ String
19 20 21 |
# File 'lib/deimos/schema_class/enum.rb', line 19 def to_s @value.to_s end |