Sha256: bfd90ab817346b0e1454146cc0edd22b80c5d6c8bc2c8706ba27437d72fbef63
Contents?: true
Size: 1001 Bytes
Versions: 38
Compression:
Stored size: 1001 Bytes
Contents
# frozen_string_literal: true require_relative 'base' require 'json' module Deimos module SchemaClass # Base Class for Enum Classes generated from Avro. class Enum < Base # @return [String] attr_accessor :value # @param other [Deimos::SchemaClass::Enum] # @return [Boolean] def ==(other) other.is_a?(self.class) ? other.value == @value : other == @value end # @return [String] def to_s @value.to_s end # @param value [String] def initialize(value) @value = value end # Returns all the valid symbols for this enum. # @return [Array<String>] def symbols raise NotImplementedError end # @return [String] def as_json(_opts={}) @value end # @return [SchemaClass::Enum] def self.initialize_from_value(value) return nil if value.nil? value.is_a?(self) ? value : self.new(value) end end end end
Version data entries
38 entries across 38 versions & 1 rubygems