Class: Melbourne::AST::MAsgn
- Defined in:
- lib/melbourne/ast/variables.rb
Overview
An assignment of multiple values as in:
a, b = 1, 2
Instance Attribute Summary collapse
-
#block ⇒ Object
TODO: document!.
-
#left ⇒ Object
The left side of the assignment.
-
#right ⇒ Object
The right side of the assignment.
-
#splat ⇒ Object
TODO: document!.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(line, left, right, splat) ⇒ MAsgn
constructor
A new instance of MAsgn.
- #iter_arguments ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(line, left, right, splat) ⇒ MAsgn
Returns a new instance of MAsgn.
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/melbourne/ast/variables.rb', line 215 def initialize(line, left, right, splat) @line = line @left = left @right = right @splat = nil @block = nil # support for |&b| @fixed = right.kind_of?(ArrayLiteral) ? true : false if splat.kind_of? Node if @left if right @splat = SplatAssignment.new line, splat else @splat = SplatWrapped.new line, splat end elsif @fixed @splat = SplatArray.new line, splat, right.body.size elsif right.kind_of? SplatValue @splat = splat else @splat = SplatWrapped.new line, splat end elsif splat and @fixed @splat = EmptySplat.new line, right.body.size end end |
Instance Attribute Details
#block ⇒ Object
TODO: document!
213 214 215 |
# File 'lib/melbourne/ast/variables.rb', line 213 def block @block end |
#left ⇒ Object
The left side of the assignment
203 204 205 |
# File 'lib/melbourne/ast/variables.rb', line 203 def left @left end |
#right ⇒ Object
The right side of the assignment
207 208 209 |
# File 'lib/melbourne/ast/variables.rb', line 207 def right @right end |
#splat ⇒ Object
TODO: document!
210 211 212 |
# File 'lib/melbourne/ast/variables.rb', line 210 def splat @splat end |
Instance Method Details
#iter_arguments ⇒ Object
243 244 245 |
# File 'lib/melbourne/ast/variables.rb', line 243 def iter_arguments @iter_arguments = true end |