Class: Leftovers::AST::SendNode
- Inherits:
-
Node
- Object
- Parser::AST::Node
- Node
- Leftovers::AST::SendNode
show all
- Includes:
- HasArguments
- Defined in:
- lib/leftovers/ast/send_node.rb
Instance Method Summary
collapse
#kwargs, #positional_arguments
Methods inherited from Node
#first, #hash?, #initialize, #kwargs, #parent, #parent=, #path, #positional_arguments, #privacy, #privacy=, #proc?, #scalar?, #second, #sym?, #to_literal_s, #to_scalar_value, #updated
Instance Method Details
#arguments ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/leftovers/ast/send_node.rb', line 16
def arguments
@memo[:arguments] ||= if block_pass_argument?
children[2...-1]
else
children.drop(2)
end
end
|
#as_arguments_list ⇒ Object
24
25
26
|
# File 'lib/leftovers/ast/send_node.rb', line 24
def as_arguments_list
first.as_arguments_list if name == :freeze
end
|
#block_given? ⇒ Boolean
33
34
35
|
# File 'lib/leftovers/ast/send_node.rb', line 33
def block_given?
block_pass_argument? || parent&.type == :block
end
|
#block_pass_argument? ⇒ Boolean
28
29
30
31
|
# File 'lib/leftovers/ast/send_node.rb', line 28
def block_pass_argument?
last_child = children.last
last_child.respond_to?(:type) && last_child.type == :block_pass
end
|
#to_s ⇒ Object
12
13
14
|
# File 'lib/leftovers/ast/send_node.rb', line 12
def to_s
name.to_s
end
|