Forum: Ruby \n on windows?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Alex C. (Guest)
on 2006-02-20 05:02
(Received via mailing list)
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?
Gregory B. (Guest)
on 2006-02-20 05:11
(Received via mailing list)
On 2/19/06, Alex C. <removed_email_address@domain.invalid> wrote:
>  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 C. (Guest)
on 2006-02-20 05:32
(Received via mailing list)
On 2/19/06, Gregory B. <removed_email_address@domain.invalid> wrote:
> >   --- !ruby/object:MailTruck
> effectively, p whatever
>
> try:
> puts(YAML::dump(m))

poof!
I love it when bugs just evaporate.
David V. (Guest)
on 2006-02-21 05:00
(Received via mailing list)
DÅ?a Pondelok 20 Február 2006 04:09 Gregory B. 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 ;P 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 V.
Having a pony parade
This topic is locked and can not be replied to.