123456789_123456789_123456789_123456789_123456789_

Class: RBS::AST::Ruby::Members::AttributeMember

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Base
Instance Chain:
Inherits: RBS::AST::Ruby::Members::Base
Defined in: lib/rbs/ast/ruby/members.rb

Class Method Summary

Instance Attribute Summary

Base - Inherited

Instance Method Summary

Constructor Details

.new(buffer, node, name_nodes, leading_comment, type_annotation) ⇒ AttributeMember

[ GitHub ]

  
# 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 (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/ruby/members.rb', line 643

attr_reader :leading_comment

#name_nodes (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/ruby/members.rb', line 641

attr_reader :name_nodes

#node (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/ruby/members.rb', line 640

attr_reader :node

#type_annotation (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/ruby/members.rb', line 642

attr_reader :type_annotation

Instance Method Details

#location

[ GitHub ]

  
# File 'lib/rbs/ast/ruby/members.rb', line 659

def location
  rbs_location(node.location)
end

#name_locations

[ GitHub ]

  
# 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

[ GitHub ]

  
# File 'lib/rbs/ast/ruby/members.rb', line 653

def names
  name_nodes.map do |node|
    node.unescaped.to_sym
  end
end

#type

[ GitHub ]

  
# File 'lib/rbs/ast/ruby/members.rb', line 669

def type
  type_annotation&.type
end

#type_fingerprint

[ GitHub ]

  
# 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