J
Joel VanderWerf
We have this:
a = %w{ a b c d e f }
p a # ==> ["a", "b", "c", "d", "e", "f"]
Has anyone ever felt the need for something like
a = %t{
a b c
d e f
} # ==> [["a", "b", "c"], ["d", "e", "f"]]
It's probably too special (this is the first time in 8 years I've wanted
it), and it is easy to implement it as a method rather than a literal:
def table s
s.split("\n").map!{|t|t.split}
end
t = table %q{\
a b c
d e f
}
p t # ==> [["a", "b", "c"], ["d", "e", "f"]]
Really just an idle question...
a = %w{ a b c d e f }
p a # ==> ["a", "b", "c", "d", "e", "f"]
Has anyone ever felt the need for something like
a = %t{
a b c
d e f
} # ==> [["a", "b", "c"], ["d", "e", "f"]]
It's probably too special (this is the first time in 8 years I've wanted
it), and it is easy to implement it as a method rather than a literal:
def table s
s.split("\n").map!{|t|t.split}
end
t = table %q{\
a b c
d e f
}
p t # ==> [["a", "b", "c"], ["d", "e", "f"]]
Really just an idle question...