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.
656 657 658 659 660 661 662 |
# File 'lib/rbs/ast/ruby/members.rb', line 656 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.
654 655 656 |
# File 'lib/rbs/ast/ruby/members.rb', line 654 def leading_comment @leading_comment end |
#name_nodes ⇒ Object (readonly)
Returns the value of attribute name_nodes.
652 653 654 |
# File 'lib/rbs/ast/ruby/members.rb', line 652 def name_nodes @name_nodes end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
651 652 653 |
# File 'lib/rbs/ast/ruby/members.rb', line 651 def node @node end |
#type_annotation ⇒ Object (readonly)
Returns the value of attribute type_annotation.
653 654 655 |
# File 'lib/rbs/ast/ruby/members.rb', line 653 def type_annotation @type_annotation end |
Instance Method Details
#location ⇒ Object
670 671 672 |
# File 'lib/rbs/ast/ruby/members.rb', line 670 def location rbs_location(node.location) end |
#name_locations ⇒ Object
674 675 676 677 678 |
# File 'lib/rbs/ast/ruby/members.rb', line 674 def name_locations name_nodes.map do |name_node| rbs_location(name_node.location) end end |
#names ⇒ Object
664 665 666 667 668 |
# File 'lib/rbs/ast/ruby/members.rb', line 664 def names name_nodes.map do |node| node.unescaped.to_sym end end |
#type ⇒ Object
680 681 682 |
# File 'lib/rbs/ast/ruby/members.rb', line 680 def type type_annotation&.type end |
#type_fingerprint ⇒ Object
684 685 686 687 688 689 690 691 692 |
# File 'lib/rbs/ast/ruby/members.rb', line 684 def type_fingerprint [ "members/attribute", self.class.name, names.map(&:to_s), type_annotation&.type_fingerprint, leading_comment&.as_comment&.string ] end |