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.
401 402 403 404 405 406 407 408 409 410 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 401 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.
399 400 401 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 399 def ampersand_location @ampersand_location end |
#colon_location ⇒ Object (readonly)
Returns the value of attribute colon_location.
399 400 401 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 399 def colon_location @colon_location end |
#comment_location ⇒ Object (readonly)
Returns the value of attribute comment_location.
399 400 401 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 399 def comment_location @comment_location end |
#name_location ⇒ Object (readonly)
Returns the value of attribute name_location.
399 400 401 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 399 def name_location @name_location end |
#question_location ⇒ Object (readonly)
Returns the value of attribute question_location.
399 400 401 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 399 def question_location @question_location end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
399 400 401 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 399 def type @type end |
#type_location ⇒ Object (readonly)
Returns the value of attribute type_location.
399 400 401 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 399 def type_location @type_location end |
Instance Method Details
#map_type_name(&block) ⇒ Object
412 413 414 415 416 417 418 419 420 421 422 423 424 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 412 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
426 427 428 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 426 def name name_location&.source&.to_sym end |
#optional? ⇒ Boolean
430 431 432 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 430 def optional? question_location ? true : false end |
#required? ⇒ Boolean
434 435 436 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 434 def required? !optional? end |
#type_fingerprint ⇒ Object
438 439 440 441 442 443 444 445 446 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 438 def type_fingerprint [ "annots/block_param_type", name_location&.source, type.to_s, optional? ? "optional" : "required", comment_location&.source ] end |