improper output:
irb(main):034:0> YAML::dump m
=> "--- !ruby/object:MailTruck \ndriver: Harold\nroute: \n- 12 Corrigan Way\n- 2
3 Antler Ave\n"
irb(main):034:0>
expected output:
irb(main):033:0> YAML::dump m
--- !ruby/object:MailTruck
driver: Harold
route:
- 12 Corrigan Way
- 23 Antler Ave
irb(main):034:0>
Is this an issue with cmd.exe or irb?
Anyone know how to fix this situation?
···
--
Alex Combas
http://noodlejunkie.blogspot.com/
neither. irb was showing you the return value of your function call
effectively, p whatever
try:
puts(YAML::dump(m))
···
On 2/19/06, Alex Combas <alex.combas@gmail.com> wrote:
improper output:
irb(main):034:0> YAML::dump m
=> "--- !ruby/object:MailTruck \ndriver: Harold\nroute: \n- 12 Corrigan Way\n- 2
3 Antler Ave\n"
irb(main):034:0>
expected output:
irb(main):033:0> YAML::dump m
--- !ruby/object:MailTruck
driver: Harold
route:
- 12 Corrigan Way
- 23 Antler Ave
irb(main):034:0>
Is this an issue with cmd.exe or irb?
Anyone know how to fix this situation?
poof!
I love it when bugs just evaporate.
···
On 2/19/06, Gregory Brown <gregory.t.brown@gmail.com> wrote:
On 2/19/06, Alex Combas <alex.combas@gmail.com> wrote:
> improper output:
> irb(main):034:0> YAML::dump m
> => "--- !ruby/object:MailTruck \ndriver: Harold\nroute: \n- 12 Corrigan Way\n- 2
> 3 Antler Ave\n"
> irb(main):034:0>
>
>
> expected output:
> irb(main):033:0> YAML::dump m
> --- !ruby/object:MailTruck
> driver: Harold
> route:
> - 12 Corrigan Way
> - 23 Antler Ave
> irb(main):034:0>
>
> Is this an issue with cmd.exe or irb?
> Anyone know how to fix this situation?
neither. irb was showing you the return value of your function call
effectively, p whatever
try:
puts(YAML::dump(m))
--
Alex Combas
http://noodlejunkie.blogspot.com/
Dňa Pondelok 20 Február 2006 04:09 Gregory Brown napísal:
neither. irb was showing you the return value of your function call
effectively, p whatever
try:
puts(YAML::dump(m))
Meh. So gruesomely verbose
Quoting yaml.rb:
···
#
# ryan:: You know how Kernel.p is a really convenient way to dump ruby
# structures? The only downside is that it's not as legible as
# YAML.
#
# _why:: (listening)
#
# ryan:: I know you don't want to urinate all over your users' namespaces.
# But, on the other hand, convenience of dumping for debugging is,
# IMO, a big YAML use case.
#
# _why:: Go nuts! Have a pony parade!
#
# ryan:: Either way, I certainly will have a pony parade.
#
(Definition of Kernel#y follows.)
Use:
y m
David Vallner
Having a pony parade