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.



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

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.



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

def declared_in
  @declared_in
end

#parent_variableObject (readonly)

Returns the value of attribute parent_variable.



4
5
6
# File 'lib/rbs/definition.rb', line 4

def parent_variable
  @parent_variable
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#sub(s) ⇒ Object



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

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