this time I started to work with STDOUT, STDERR, STDIN. Handy that there is a class which handles all this for me: open3: http://ruby-doc.org/stdlib/libdoc/open3/rdoc/index.html
While doing so I came along this piece of code:
stdin, stdout, stderr = popen3('pwd')
a = stdout.readlines()
And I started asking myself if there is a difference between
assert_equal("/cygdrive/d/BACKUP~1/SMG\n", a.to_s, 'using readlines to squeeze stdout into a string, with braces')
assert_equal "/cygdrive/d/BACKUP~1/SMG\n", a.to_s, 'using readlines to squeeze stdout into a string,
without braces'
I did not find an answer yet, hence a new todo was born: [ToDo: find out if there is a difference between function calls with or without braces]
What I did find out was that there are differences between strings and symbols: Have a look here: http://www.robertsosinski.com/2009/01/11/the-difference-between-ruby-symbols-and-strings/
What I also did find out was that there is a difference between "a String" and "an other String". Have a look here: http://en.wikibooks.org/wiki/Ruby_Programming/Strings#Interpolation
Keine Kommentare:
Kommentar veröffentlichen