Class: RBS::AST::Ruby::Members::AttributeMember
- Defined in:
- lib/rbs/ast/ruby/members.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#leading_comment ⇒ Object
readonly
Returns the value of attribute leading_comment.
-
#name_nodes ⇒ Object
readonly
Returns the value of attribute name_nodes.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#type_annotation ⇒ Object
readonly
Returns the value of attribute type_annotation.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(buffer, node, name_nodes, leading_comment, type_annotation) ⇒ AttributeMember
constructor
A new instance of AttributeMember.
- #location ⇒ Object
- #name_locations ⇒ Object
- #names ⇒ Object
- #type ⇒ Object
- #type_fingerprint ⇒ Object
Methods included from Helpers::LocationHelper
Constructor Details
#initialize(buffer, node, name_nodes, leading_comment, type_annotation) ⇒ AttributeMember
Returns a new instance of AttributeMember.
645 646 647 648 649 650 651 |
# File 'lib/rbs/ast/ruby/members.rb', line 645 def initialize(buffer, node, name_nodes, leading_comment, type_annotation) super(buffer) @node = node @name_nodes = name_nodes @leading_comment = leading_comment @type_annotation = type_annotation end |
Instance Attribute Details
#leading_comment ⇒ Object (readonly)
Returns the value of attribute leading_comment.
643 644 645 |
# File 'lib/rbs/ast/ruby/members.rb', line 643 def leading_comment @leading_comment end |
#name_nodes ⇒ Object (readonly)
Returns the value of attribute name_nodes.
641 642 643 |
# File 'lib/rbs/ast/ruby/members.rb', line 641 def name_nodes @name_nodes end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
640 641 642 |
# File 'lib/rbs/ast/ruby/members.rb', line 640 def node @node end |
#type_annotation ⇒ Object (readonly)
Returns the value of attribute type_annotation.
642 643 644 |
# File 'lib/rbs/ast/ruby/members.rb', line 642 def type_annotation @type_annotation end |
Instance Method Details
#location ⇒ Object
659 660 661 |
# File 'lib/rbs/ast/ruby/members.rb', line 659 def location rbs_location(node.location) end |
#name_locations ⇒ Object
663 664 665 666 667 |
# File 'lib/rbs/ast/ruby/members.rb', line 663 def name_locations name_nodes.map do |name_node| rbs_location(name_node.location) end end |
#names ⇒ Object
653 654 655 656 657 |
# File 'lib/rbs/ast/ruby/members.rb', line 653 def names name_nodes.map do |node| node.unescaped.to_sym end end |
#type ⇒ Object
669 670 671 |
# File 'lib/rbs/ast/ruby/members.rb', line 669 def type type_annotation&.type end |
#type_fingerprint ⇒ Object
673 674 675 676 677 678 679 680 681 |
# File 'lib/rbs/ast/ruby/members.rb', line 673 def type_fingerprint [ "members/attribute", self.class.name, names.map(&:to_s), type_annotation&.type_fingerprint, leading_comment&.as_comment&.string ] end |