class RBS::AST::Ruby::Annotations::BlockParamTypeAnnotation
@rbs &name: TYPE -- comment annotation in leading comments
@rbs &block: () -> void -- comment
^^^^ -- prefix_location
^ -- ampersand_location
^^^^^ -- name_location
^ -- colon_location
^^^^^^^^^^ -- type_location
^^^^^^^^^^ -- comment_location
@rbs &: ? () -> void
^^^^ -- prefix_location
^ -- ampersand_location
^ -- colon_location
^ -- question_location
^^^^^^^^^^ -- type_location
Attributes
ampersand_location
[R]
Location
colon_location
[R]
Location
comment_location
[R]
Location?
name_location
[R]
Location?
question_location
[R]
Location?
type
[R]
Types::function
type_location
[R]
Location
Public Class Methods
(location: Location, prefix_location: Location, ampersand_location: Location, name_location: Location?, colon_location: Location, question_location: Location?, type_location: Location, type: Types::function, comment_location: Location?) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/ruby/annotations.rb, line 359 def initialize(location:, prefix_location:, ampersand_location:, name_location:, colon_location:, question_location:, type_location:, type:, comment_location:) super(location, prefix_location) @ampersand_location = ampersand_location @name_location = name_location @colon_location = colon_location @question_location = question_location @type_location = type_location @type = type @comment_location = comment_location end
Calls superclass method
RBS::AST::Ruby::Annotations::Base::new
Public Instance Methods
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/ruby/annotations.rb, line 370 def map_type_name(&block) self.class.new( location:, prefix_location:, ampersand_location: ampersand_location, name_location: name_location, colon_location: colon_location, question_location: question_location, type_location: type_location, type: type.map_type_name { yield _1 }, comment_location: comment_location ) #: self end
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/ruby/annotations.rb, line 384 def name name_location&.source&.to_sym end
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/ruby/annotations.rb, line 388 def optional? question_location ? true : false end
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/ruby/annotations.rb, line 392 def required? !optional? end
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/ruby/annotations.rb, line 396 def type_fingerprint [ "annots/block_param_type", name_location&.source, type.to_s, optional? ? "optional" : "required", comment_location&.source ] end