Method: Path#tail

Defined in:
lib/epath/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.



87
88
89
90
91
92
93
# File 'lib/epath/io.rb', line 87

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