Class: Deimos::SchemaClass::Base
- Inherits:
-
Object
- Object
- Deimos::SchemaClass::Base
- Defined in:
- lib/deimos/schema_class/base.rb,
sig/defs.rbs
Overview
Base Class for Schema Classes generated from Avro.
Class Method Summary collapse
-
.initialize_from_value(_value) ⇒ SchemaClass::Base
Initializes this class from a given value.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
@param
other. -
#[]=(key, val) ⇒ void
@param
key. -
#as_json(_opts = {}) ⇒ ::Hash[untyped, untyped]
Converts the object to a hash which can be used for debugging or comparing objects.
- #hash ⇒ Integer
-
#initialize(*_args) ⇒ Base
constructor
@param
_args. - #inspect ⇒ String
Constructor Details
#initialize(*_args) ⇒ Base
@param _args
11 12 |
# File 'lib/deimos/schema_class/base.rb', line 11 def initialize(*_args) end |
Class Method Details
.initialize_from_value(_value) ⇒ SchemaClass::Base
Initializes this class from a given value
@param value
50 51 52 |
# File 'lib/deimos/schema_class/base.rb', line 50 def self.initialize_from_value(_value) raise MissingImplementationError end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
@param other
30 31 32 33 34 35 36 37 |
# File 'lib/deimos/schema_class/base.rb', line 30 def ==(other) comparison = other if other.class == self.class comparison = other.as_json end comparison == self.as_json end |
#[]=(key, val) ⇒ void
This method returns an undefined value.
@param key
@param val
24 25 26 |
# File 'lib/deimos/schema_class/base.rb', line 24 def []=(key, val) self.send("#{key}=", val) end |
#as_json(_opts = {}) ⇒ ::Hash[untyped, untyped]
Converts the object to a hash which can be used for debugging or comparing objects.
@param _opts
@return — a hash representation of the payload
17 18 19 |
# File 'lib/deimos/schema_class/base.rb', line 17 def as_json(_opts={}) raise MissingImplementationError end |
#hash ⇒ Integer
57 58 59 |
# File 'lib/deimos/schema_class/base.rb', line 57 def hash as_json.hash end |
#inspect ⇒ String
42 43 44 45 |
# File 'lib/deimos/schema_class/base.rb', line 42 def inspect klass = self.class "#{klass}(#{self.as_json})" end |