Class: RBS::AST::Ruby::Annotations::BlockParamTypeAnnotation
- Defined in:
- lib/rbs/ast/ruby/annotations.rb
Instance Attribute Summary collapse
-
#ampersand_location ⇒ Object
readonly
Returns the value of attribute ampersand_location.
-
#colon_location ⇒ Object
readonly
Returns the value of attribute colon_location.
-
#comment_location ⇒ Object
readonly
Returns the value of attribute comment_location.
-
#name_location ⇒ Object
readonly
Returns the value of attribute name_location.
-
#question_location ⇒ Object
readonly
Returns the value of attribute question_location.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#type_location ⇒ Object
readonly
Returns the value of attribute type_location.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(location:, prefix_location:, ampersand_location:, name_location:, colon_location:, question_location:, type_location:, type:, comment_location:) ⇒ BlockParamTypeAnnotation
constructor
A new instance of BlockParamTypeAnnotation.
- #map_type_name(&block) ⇒ Object
- #name ⇒ Object
- #optional? ⇒ Boolean
- #required? ⇒ Boolean
- #type_fingerprint ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(location:, prefix_location:, ampersand_location:, name_location:, colon_location:, question_location:, type_location:, type:, comment_location:) ⇒ BlockParamTypeAnnotation
Returns a new instance of BlockParamTypeAnnotation.
359 360 361 362 363 364 365 366 367 368 |
# File '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 |
Instance Attribute Details
#ampersand_location ⇒ Object (readonly)
Returns the value of attribute ampersand_location.
357 358 359 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 357 def ampersand_location @ampersand_location end |
#colon_location ⇒ Object (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_location ⇒ Object (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 |
#name_location ⇒ Object (readonly)
Returns the value of attribute name_location.
357 358 359 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 357 def name_location @name_location end |
#question_location ⇒ Object (readonly)
Returns the value of attribute question_location.
357 358 359 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 357 def question_location @question_location end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
357 358 359 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 357 def type @type end |
#type_location ⇒ Object (readonly)
Returns the value of attribute type_location.
357 358 359 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 357 def type_location @type_location end |
Instance Method Details
#map_type_name(&block) ⇒ Object
370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File '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 |
#name ⇒ Object
384 385 386 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 384 def name name_location&.source&.to_sym end |
#optional? ⇒ Boolean
388 389 390 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 388 def optional? question_location ? true : false end |
#required? ⇒ Boolean
392 393 394 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 392 def required? !optional? end |
#type_fingerprint ⇒ Object
396 397 398 399 400 401 402 403 404 |
# File '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 |