Method: Pathname#readline
- Defined in:
- lib/standard/facets/pathname/readline.rb
#readline(*args) ⇒ Object
Reads the first line of the file
Captures the best practice from this post at stack overflow: stackoverflow.com/questions/1490138/reading-the-first-line-of-a-file-in-ruby
Credit: Ryan Duryea
8 9 10 |
# File 'lib/standard/facets/pathname/readline.rb', line 8 def readline(*args) open { |f| f.readline(*args) } end |