Class: RBS::AST::Ruby::Annotations::InstanceVariableAnnotation

Inherits:
Base
  • Object
show all
Defined in:
lib/rbs/ast/ruby/annotations.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#location, #prefix_location

Instance Method Summary collapse

Methods inherited from Base

#buffer

Constructor Details

#initialize(location:, prefix_location:, ivar_name:, ivar_name_location:, colon_location:, type:, comment_location:) ⇒ InstanceVariableAnnotation

Returns a new instance of InstanceVariableAnnotation.



225
226
227
228
229
230
231
232
# File 'lib/rbs/ast/ruby/annotations.rb', line 225

def initialize(location:, prefix_location:, ivar_name:, ivar_name_location:, colon_location:, type:, comment_location:)
  super(location, prefix_location)
  @ivar_name = ivar_name
  @ivar_name_location = ivar_name_location
  @colon_location = colon_location
  @type = type
  @comment_location = comment_location
end

Instance Attribute Details

#colon_locationObject (readonly)

Returns the value of attribute colon_location.



223
224
225
# File 'lib/rbs/ast/ruby/annotations.rb', line 223

def colon_location
  @colon_location
end

#comment_locationObject (readonly)

Returns the value of attribute comment_location.



223
224
225
# File 'lib/rbs/ast/ruby/annotations.rb', line 223

def comment_location
  @comment_location
end

#ivar_nameObject (readonly)

Returns the value of attribute ivar_name.



223
224
225
# File 'lib/rbs/ast/ruby/annotations.rb', line 223

def ivar_name
  @ivar_name
end

#ivar_name_locationObject (readonly)

Returns the value of attribute ivar_name_location.



223
224
225
# File 'lib/rbs/ast/ruby/annotations.rb', line 223

def ivar_name_location
  @ivar_name_location
end

#typeObject (readonly)

Returns the value of attribute type.



223
224
225
# File 'lib/rbs/ast/ruby/annotations.rb', line 223

def type
  @type
end

Instance Method Details

#map_type_name(&block) ⇒ Object



234
235
236
237
238
239
240
241
242
243
244
# File 'lib/rbs/ast/ruby/annotations.rb', line 234

def map_type_name(&block)
  self.class.new(
    location:,
    prefix_location:,
    ivar_name:,
    ivar_name_location:,
    colon_location:,
    type: type.map_type_name { yield _1 },
    comment_location:
  ) #: self
end

#type_fingerprintObject



246
247
248
249
250
251
252
253
# File 'lib/rbs/ast/ruby/annotations.rb', line 246

def type_fingerprint
  [
    "annots/instance_variable",
    ivar_name.to_s,
    type.to_s,
    comment_location&.source
  ]
end