Class: RBS::Definition::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs/definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent_variable:, type:, declared_in:) ⇒ Variable

Returns a new instance of Variable.



10
11
12
13
14
# File 'lib/rbs/definition.rb', line 10

def initialize(parent_variable:, type:, declared_in:)
  @parent_variable = parent_variable
  @type = type
  @declared_in = declared_in
end

Instance Attribute Details

#declared_inObject (readonly)

Returns the value of attribute declared_in.



8
9
10
# File 'lib/rbs/definition.rb', line 8

def declared_in
  @declared_in
end

#parent_variableObject (readonly)

Returns the value of attribute parent_variable.



6
7
8
# File 'lib/rbs/definition.rb', line 6

def parent_variable
  @parent_variable
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/rbs/definition.rb', line 7

def type
  @type
end

Instance Method Details

#sub(s) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/rbs/definition.rb', line 16

def sub(s)
  self.class.new(
    parent_variable: parent_variable,
    type: type.sub(s),
    declared_in: declared_in
  )
end