Class: RBI::Send

Inherits:
NodeWithComments show all
Extended by:
T::Sig
Includes:
Indexable
Defined in:
lib/rbi/model.rb,
lib/rbi/index.rb,
lib/rbi/rewriters/merge_trees.rb

Overview

Sends

Instance Attribute Summary collapse

Attributes inherited from NodeWithComments

#comments

Attributes inherited from Node

#loc, #parent_tree

Instance Method Summary collapse

Methods inherited from NodeWithComments

#annotations, #merge_with, #version_requirements

Methods inherited from Node

#detach, #merge_with, #parent_conflict_tree, #parent_scope, #print, #replace, #satisfies_version?, #string

Constructor Details

#initialize(method, args = [], loc: nil, comments: [], &block) ⇒ Send

Returns a new instance of Send.



1020
1021
1022
1023
1024
1025
# File 'lib/rbi/model.rb', line 1020

def initialize(method, args = [], loc: nil, comments: [], &block)
  super(loc: loc, comments: comments)
  @method = method
  @args = args
  block&.call(self)
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



1009
1010
1011
# File 'lib/rbi/model.rb', line 1009

def args
  @args
end

#methodObject (readonly)

Returns the value of attribute method.



1006
1007
1008
# File 'lib/rbi/model.rb', line 1006

def method
  @method
end

Instance Method Details

#<<(arg) ⇒ Object



1028
1029
1030
# File 'lib/rbi/model.rb', line 1028

def <<(arg)
  @args << arg
end

#==(other) ⇒ Object



1033
1034
1035
# File 'lib/rbi/model.rb', line 1033

def ==(other)
  Send === other && method == other.method && args == other.args
end

#compatible_with?(other) ⇒ Boolean

Returns:

  • (Boolean)


531
532
533
# File 'lib/rbi/rewriters/merge_trees.rb', line 531

def compatible_with?(other)
  other.is_a?(Send) && method == other.method && args == other.args
end

#index_idsObject



193
194
195
# File 'lib/rbi/index.rb', line 193

def index_ids
  ["#{parent_scope&.fully_qualified_name}.#{method}"]
end

#to_sObject



1038
1039
1040
# File 'lib/rbi/model.rb', line 1038

def to_s
  "#{parent_scope&.fully_qualified_name}.#{method}(#{args.join(", ")})"
end