Class: RBS::AST::Ruby::Annotations::ModuleSelfAnnotation

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:, keyword_location:, colon_location:, name:, args:, open_bracket_location:, close_bracket_location:, args_comma_locations:, comment_location:) ⇒ ModuleSelfAnnotation

Returns a new instance of ModuleSelfAnnotation.



359
360
361
362
363
364
365
366
367
368
369
# File 'lib/rbs/ast/ruby/annotations.rb', line 359

def initialize(location:, prefix_location:, keyword_location:, colon_location:, name:, args:, open_bracket_location:, close_bracket_location:, args_comma_locations:, comment_location:)
  super(location, prefix_location)
  @keyword_location = keyword_location
  @colon_location = colon_location
  @name = name
  @args = args
  @open_bracket_location = open_bracket_location
  @close_bracket_location = close_bracket_location
  @args_comma_locations = args_comma_locations
  @comment_location = comment_location
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



357
358
359
# File 'lib/rbs/ast/ruby/annotations.rb', line 357

def args
  @args
end

#args_comma_locationsObject (readonly)

Returns the value of attribute args_comma_locations.



357
358
359
# File 'lib/rbs/ast/ruby/annotations.rb', line 357

def args_comma_locations
  @args_comma_locations
end

#close_bracket_locationObject (readonly)

Returns the value of attribute close_bracket_location.



357
358
359
# File 'lib/rbs/ast/ruby/annotations.rb', line 357

def close_bracket_location
  @close_bracket_location
end

#colon_locationObject (readonly)

Returns the value of attribute colon_location.



357
358
359
# File 'lib/rbs/ast/ruby/annotations.rb', line 357

def colon_location
  @colon_location
end

#comment_locationObject (readonly)

Returns the value of attribute comment_location.



357
358
359
# File 'lib/rbs/ast/ruby/annotations.rb', line 357

def comment_location
  @comment_location
end

#keyword_locationObject (readonly)

Returns the value of attribute keyword_location.



357
358
359
# File 'lib/rbs/ast/ruby/annotations.rb', line 357

def keyword_location
  @keyword_location
end

#nameObject (readonly)

Returns the value of attribute name.



357
358
359
# File 'lib/rbs/ast/ruby/annotations.rb', line 357

def name
  @name
end

#open_bracket_locationObject (readonly)

Returns the value of attribute open_bracket_location.



357
358
359
# File 'lib/rbs/ast/ruby/annotations.rb', line 357

def open_bracket_location
  @open_bracket_location
end

Instance Method Details

#map_type_nameObject



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/rbs/ast/ruby/annotations.rb', line 371

def map_type_name
  mapped_args = args.map { |type| type.map_type_name { yield _1 } }

  self.class.new(
    location:,
    prefix_location:,
    keyword_location:,
    colon_location:,
    name: yield(name),
    args: mapped_args,
    open_bracket_location:,
    close_bracket_location:,
    args_comma_locations:,
    comment_location:
  ) #: self
end

#type_fingerprintObject



388
389
390
391
392
393
394
395
# File 'lib/rbs/ast/ruby/annotations.rb', line 388

def type_fingerprint
  [
    "annots/module_self",
    name.to_s,
    args.map(&:to_s),
    comment_location&.source
  ]
end