Class: Melbourne::AST::PushArgs
Overview
Arguments of element assignment as in:
a[0] = 1 # 1 is the push argument
Instance Attribute Summary collapse
-
#arguments ⇒ Object
The arguments used to access the element the push argument is assigned to.
-
#value ⇒ Object
The actual value of the argument.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(line, arguments, value) ⇒ PushArgs
constructor
A new instance of PushArgs.
-
#size ⇒ Object
Gets the number of push arguments.
-
#splat? ⇒ Boolean
Gets whether the push arguments are a splat (+*some+).
Methods inherited from Node
Constructor Details
#initialize(line, arguments, value) ⇒ PushArgs
Returns a new instance of PushArgs.
115 116 117 118 119 |
# File 'lib/melbourne/ast/sends.rb', line 115 def initialize(line, arguments, value) @line = line @arguments = arguments @value = value end |
Instance Attribute Details
#arguments ⇒ Object
The arguments used to access the element the push argument is assigned to
113 114 115 |
# File 'lib/melbourne/ast/sends.rb', line 113 def arguments @arguments end |
#value ⇒ Object
The actual value of the argument
109 110 111 |
# File 'lib/melbourne/ast/sends.rb', line 109 def value @value end |
Instance Method Details
#size ⇒ Object
Gets the number of push arguments
Example:
a[0] = 1 # size is 1
127 128 129 |
# File 'lib/melbourne/ast/sends.rb', line 127 def size splat? ? 1 : @arguments.size + 1 end |
#splat? ⇒ Boolean
Gets whether the push arguments are a splat (+*some+)
Example:
a[0] = *b # the push arguments are a splat here
137 138 139 |
# File 'lib/melbourne/ast/sends.rb', line 137 def splat? @arguments.kind_of? SplatValue end |