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.
622fa8560c82dfaa59c91ec75efb0c19?d=identicon&s=25 Alex Combas (Guest)
on 2006-02-20 04: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?
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2006-02-20 04:11
(Received via mailing list)
On 2/19/06, Alex Combas <alex.combas@gmail.com> 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))
622fa8560c82dfaa59c91ec75efb0c19?d=identicon&s=25 Alex Combas (Guest)
on 2006-02-20 04:32
(Received via mailing list)
On 2/19/06, Gregory Brown <gregory.t.brown@gmail.com> wrote:
> >   --- !ruby/object:MailTruck
> effectively, p whatever
>
> try:
> puts(YAML::dump(m))

poof!
I love it when bugs just evaporate.
430ea1cba106cc65b7687d66e9df4f06?d=identicon&s=25 David Vallner (Guest)
on 2006-02-21 04:00
(Received via mailing list)
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 ;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 Vallner
Having a pony parade
This topic is locked and can not be replied to.