Class: Natsuzora::Contract::AST::Ref

Inherits:
Node
  • Object
show all
Defined in:
lib/natsuzora/contract/ast/ref.rb

Overview

Type reference (used during parsing, resolved before use).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Ref

Returns a new instance of Ref.



12
13
14
15
# File 'lib/natsuzora/contract/ast/ref.rb', line 12

def initialize(name)
  super()
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/natsuzora/contract/ast/ref.rb', line 10

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



21
22
23
# File 'lib/natsuzora/contract/ast/ref.rb', line 21

def ==(other)
  other.is_a?(Ref) && other.name == @name
end

#to_hObject



17
18
19
# File 'lib/natsuzora/contract/ast/ref.rb', line 17

def to_h
  { 'kind' => 'ref', 'name' => @name }
end