Sha256: 3fe0869521c366361f390382d2471fbf40b1f1420fd314fbfe12e8f40ce835a8
Contents?: true
Size: 1.28 KB
Versions: 38
Compression:
Stored size: 1.28 KB
Contents
# frozen_string_literal: true require 'json' module Deimos module SchemaClass # Base Class for Schema Classes generated from Avro. class Base # @param _args [Array<Object>] def initialize(*_args) end # Converts the object to a hash which can be used for debugging or comparing objects. # @param _opts [Hash] # @return [Hash] a hash representation of the payload def as_json(_opts={}) raise NotImplementedError end # @param key [String,Symbol] # @param val [Object] # @return [void] def []=(key, val) self.send("#{key}=", val) end # @param other [SchemaClass::Base] # @return [Boolean] def ==(other) comparison = other if other.class == self.class comparison = other.as_json end comparison == self.as_json end # @return [String] def inspect klass = self.class "#{klass}(#{self.as_json})" end # Initializes this class from a given value # @param value [Object] # @return [SchemaClass::Base] def self.initialize_from_value(value) raise NotImplementedError end protected # @return [Integer] def hash as_json.hash end end end end
Version data entries
38 entries across 38 versions & 1 rubygems