Class: Steep::Interface::IvarChain

Inherits:
Object
  • Object
show all
Defined in:
lib/steep/interface/ivar_chain.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, parent: nil) ⇒ IvarChain

Returns a new instance of IvarChain.



7
8
9
10
# File 'lib/steep/interface/ivar_chain.rb', line 7

def initialize(type:, parent: nil)
  @type = type
  @parent = parent
end

Instance Attribute Details

#parentObject (readonly)

Returns the value of attribute parent.



5
6
7
# File 'lib/steep/interface/ivar_chain.rb', line 5

def parent
  @parent
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/steep/interface/ivar_chain.rb', line 4

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



12
13
14
15
16
# File 'lib/steep/interface/ivar_chain.rb', line 12

def ==(other)
  other.is_a?(IvarChain) &&
    type == type &&
    parent == parent
end

#subst(s) ⇒ Object



18
19
20
21
22
23
# File 'lib/steep/interface/ivar_chain.rb', line 18

def subst(s)
  self.class.new(
    type: type.subst(s),
    parent: parent&.subst(s)
  )
end