Method: Path#tail

Defined in:
lib/path/io.rb

#tail(bytes) ⇒ Object

Returns the last bytes bytes of the file. If the file size is smaller than bytes, return the whole contents.



97
98
99
100
101
102
103
# File 'lib/path/io.rb', line 97

def tail(bytes)
  return read if size < bytes
  open { |f|
    f.seek(-bytes, IO::SEEK_END)
    f.read
  }
end