Class: Scribble::Nodes::Call
Instance Attribute Summary collapse
-
#allow_variable ⇒ Object
readonly
Returns the value of attribute allow_variable.
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#nodes ⇒ Object
Returns the value of attribute nodes.
-
#receiver ⇒ Object
Returns the value of attribute receiver.
Attributes inherited from Node
Instance Method Summary collapse
- #block? ⇒ Boolean
- #evaluate(context, allow_block: true, allow_split: false) ⇒ Object
-
#initialize(slice, name, args: [], receiver: nil, allow_variable: false) ⇒ Call
constructor
A new instance of Call.
- #split? ⇒ Boolean
Methods inherited from Node
Constructor Details
#initialize(slice, name, args: [], receiver: nil, allow_variable: false) ⇒ Call
Returns a new instance of Call.
8 9 10 11 |
# File 'lib/scribble/nodes/call.rb', line 8 def initialize slice, name, args: [], receiver: nil, allow_variable: false super slice @name, @args, @receiver, @allow_variable = name, args, receiver, allow_variable end |
Instance Attribute Details
#allow_variable ⇒ Object (readonly)
Returns the value of attribute allow_variable.
4 5 6 |
# File 'lib/scribble/nodes/call.rb', line 4 def allow_variable @allow_variable end |
#args ⇒ Object (readonly)
Returns the value of attribute args.
4 5 6 |
# File 'lib/scribble/nodes/call.rb', line 4 def args @args end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/scribble/nodes/call.rb', line 4 def name @name end |
#nodes ⇒ Object
Returns the value of attribute nodes.
6 7 8 |
# File 'lib/scribble/nodes/call.rb', line 6 def nodes @nodes end |
#receiver ⇒ Object
Returns the value of attribute receiver.
6 7 8 |
# File 'lib/scribble/nodes/call.rb', line 6 def receiver @receiver end |
Instance Method Details
#block? ⇒ Boolean
28 29 30 |
# File 'lib/scribble/nodes/call.rb', line 28 def block? Registry.block? name end |
#evaluate(context, allow_block: true, allow_split: false) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/scribble/nodes/call.rb', line 13 def evaluate context, allow_block: true, allow_split: false disallow_split unless allow_split disallow_block unless allow_block if @receiver Registry.evaluate @name, evaluated_receiver(context), evaluated_args(context), self, context else context.evaluate self, evaluated_args(context), context end rescue Errors::UnlocatedArgument => e raise Errors::Argument.new("#{e.message} #{line_and_column}") rescue Support::Unmatched => e raise e.to_error self end |
#split? ⇒ Boolean
32 33 34 |
# File 'lib/scribble/nodes/call.rb', line 32 def split? Registry.split? name end |