Class: Avromatic::IO::UnionDatum

Inherits:
Object
  • Object
show all
Defined in:
lib/avromatic/io/union_datum.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(member_index, datum) ⇒ UnionDatum

Returns a new instance of UnionDatum.



8
9
10
11
# File 'lib/avromatic/io/union_datum.rb', line 8

def initialize(member_index, datum)
  @member_index = member_index
  @datum = datum
end

Instance Attribute Details

#datumObject (readonly)

Returns the value of attribute datum.



6
7
8
# File 'lib/avromatic/io/union_datum.rb', line 6

def datum
  @datum
end

#member_indexObject (readonly)

Returns the value of attribute member_index.



6
7
8
# File 'lib/avromatic/io/union_datum.rb', line 6

def member_index
  @member_index
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



13
14
15
16
17
# File 'lib/avromatic/io/union_datum.rb', line 13

def ==(other)
  other.is_a?(Avromatic::IO::UnionDatum) &&
    member_index == other.member_index &&
    datum == other.datum
end

#hashObject



20
21
22
# File 'lib/avromatic/io/union_datum.rb', line 20

def hash
  31 * datum.hash + member_index
end