Module: Finitio::HeadingBasedType

Included in:
MultiRelationType, MultiTupleType, RelationType, TupleType
Defined in:
lib/finitio/type/heading_based_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#headingObject (readonly)

Returns the value of attribute heading.



12
13
14
# File 'lib/finitio/type/heading_based_type.rb', line 12

def heading
  @heading
end

Instance Method Details

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



18
19
20
# File 'lib/finitio/type/heading_based_type.rb', line 18

def ==(other)
  super || (other.is_a?(self.class) && heading == other.heading)
end

#[](attrname) ⇒ Object



14
15
16
# File 'lib/finitio/type/heading_based_type.rb', line 14

def [](attrname)
  heading.fetch(attrname)
end

#hashObject



23
24
25
# File 'lib/finitio/type/heading_based_type.rb', line 23

def hash
  self.class.hash ^ heading.hash
end

#initialize(heading, name = nil, metadata = nil) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/finitio/type/heading_based_type.rb', line 4

def initialize(heading, name = nil,  = nil)
  unless heading.is_a?(Heading)
    raise ArgumentError, "Heading expected, got `#{heading}`"
  end

  super(name, )
  @heading = heading
end