2010-01-11 22:04:25 -05:00
|
|
|
a: -1
|
|
|
|
b: -2
|
|
|
|
|
|
|
|
[a, b]: [b, a]
|
|
|
|
|
2010-01-29 23:30:54 -05:00
|
|
|
puts a is -2
|
|
|
|
puts b is -1
|
2010-01-11 22:04:25 -05:00
|
|
|
|
|
|
|
|
|
|
|
arr: [1, 2, 3]
|
|
|
|
|
|
|
|
[a, b, c]: arr
|
|
|
|
|
2010-01-29 23:30:54 -05:00
|
|
|
puts a is 1
|
|
|
|
puts b is 2
|
|
|
|
puts c is 3
|
2010-01-11 22:04:25 -05:00
|
|
|
|
|
|
|
|
|
|
|
obj: {x: 10, y: 20, z: 30}
|
|
|
|
|
|
|
|
{x: a, y: b, z: c}: obj
|
|
|
|
|
2010-01-29 23:30:54 -05:00
|
|
|
puts a is 10
|
|
|
|
puts b is 20
|
|
|
|
puts c is 30
|
2010-01-11 22:04:25 -05:00
|
|
|
|
|
|
|
|
|
|
|
person: {
|
|
|
|
name: "Bob"
|
|
|
|
family: {
|
|
|
|
brother: {
|
|
|
|
addresses: [
|
|
|
|
"first"
|
|
|
|
{
|
|
|
|
street: "101 Deercreek Ln."
|
|
|
|
city: "Moquasset NY, 10021"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{name: a, family: {brother: {addresses: [one, {city: b}]}}}: person
|
|
|
|
|
2010-01-29 23:30:54 -05:00
|
|
|
puts a is "Bob"
|
|
|
|
puts b is "Moquasset NY, 10021"
|
2010-01-13 22:25:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
test: {
|
|
|
|
person: {
|
|
|
|
address: [
|
|
|
|
"------"
|
|
|
|
"Street 101"
|
|
|
|
"Apt 101"
|
|
|
|
"City 101"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{person: {address: [ignore, addr...]}}: test
|
|
|
|
|
2010-01-29 23:30:54 -05:00
|
|
|
puts addr.join(', ') is "Street 101, Apt 101, City 101"
|