Class: RBS::AST::Ruby::Members::MixinMember

Inherits:
Base
  • Object
show all
Defined in:
lib/rbs/ast/ruby/members.rb

Direct Known Subclasses

ExtendMember, IncludeMember, PrependMember

Instance Attribute Summary collapse

Attributes inherited from Base

#buffer

Instance Method Summary collapse

Methods included from Helpers::LocationHelper

#rbs_location

Constructor Details

#initialize(buffer, node, module_name, annotation) ⇒ MixinMember

Returns a new instance of MixinMember.



598
599
600
601
602
603
# File 'lib/rbs/ast/ruby/members.rb', line 598

def initialize(buffer, node, module_name, annotation)
  super(buffer)
  @node = node
  @module_name = module_name
  @annotation = annotation
end

Instance Attribute Details

#annotationObject (readonly)

Returns the value of attribute annotation.



596
597
598
# File 'lib/rbs/ast/ruby/members.rb', line 596

def annotation
  @annotation
end

#module_nameObject (readonly)

Returns the value of attribute module_name.



595
596
597
# File 'lib/rbs/ast/ruby/members.rb', line 595

def module_name
  @module_name
end

#nodeObject (readonly)

Returns the value of attribute node.



594
595
596
# File 'lib/rbs/ast/ruby/members.rb', line 594

def node
  @node
end

Instance Method Details

#locationObject



605
606
607
# File 'lib/rbs/ast/ruby/members.rb', line 605

def location
  rbs_location(node.location)
end

#name_locationObject



609
610
611
612
613
614
# File 'lib/rbs/ast/ruby/members.rb', line 609

def name_location
  args = node.arguments or raise
  first_arg = args.arguments.first or raise

  rbs_location(first_arg.location)
end

#type_argsObject



616
617
618
# File 'lib/rbs/ast/ruby/members.rb', line 616

def type_args
  annotation&.type_args || []
end

#type_fingerprintObject



620
621
622
623
624
625
626
627
# File 'lib/rbs/ast/ruby/members.rb', line 620

def type_fingerprint
  [
    "members/mixin",
    self.class.name,
    module_name.to_s,
    annotation&.type_fingerprint
  ]
end