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.
Methods inherited from Base
Constructor Details
#initialize(value) ⇒ Enum
Returns a new instance of Enum.
19 20 21 |
# File 'lib/deimos/schema_class/enum.rb', line 19 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:
35 36 37 38 39 |
# File 'lib/deimos/schema_class/enum.rb', line 35 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:
30 31 32 |
# File 'lib/deimos/schema_class/enum.rb', line 30 def as_json(_opts={}) @value end |
#symbols ⇒ Array<String>
Returns all the valid symbols for this enum.
25 26 27 |
# File 'lib/deimos/schema_class/enum.rb', line 25 def symbols raise NotImplementedError end |