Search code examples
ruby-on-railsrubyopen-uri

What is variable p in open uri module in ruby?


I am currently trying to parse a file in ruby and I ran into this example in the open uri module documentation (http://ruby-doc.org/stdlib-1.9.3/libdoc/open-uri/rdoc/OpenURI.html):

open("http://www.ruby-lang.org/") {|f|
    f.each_line {|line| p line}
  }

Do you guys know what the variable p in "|line| p line" is?

Thanks.


Solution

  • It does the same than puts but calls inspect instead of to_s on the object.