struct Tail::File
- Tail::File
- Struct
- Value
- Object
Defined in:
tail.crConstructors
-
.new(file : ::File)
Tail a file IO.
Class Method Summary
-
.open(file : Path | String, & : File -> )
Open a file to tail into it.
Instance Method Summary
-
#follow(lines = 0, line_size = 1024, delay = 0.1, &block : String -> _)
Follows the end of a file.
-
#last_lines(lines = 10, line_size = 1024) : Array(String)
Gets the last n
lines
. -
#watch(lines = 0, line_size = 1024, &block : String -> _)
Watchs for newly added bytes to the file by using inotify.
Constructor Detail
Class Method Detail
Instance Method Detail
Follows the end of a file.
Tail::File.open "file", &.follow do |str|
print str
end
Gets the last n lines
.
line_size
is used to extract the end of the file, and then calculate the trailing lines.
Tail::File.open "file", &.last_lines
Watchs for newly added bytes to the file by using inotify.