• Stars
    star
    158
  • Rank 237,131 (Top 5 %)
  • Language
    Ruby
  • License
    Apache License 2.0
  • Created over 15 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

File::Tail for Ruby

File::Tail for Ruby

Description

This is a small ruby library that allows it to "tail" files in Ruby, including following a file, that still is growing like the unix command 'tail -f' can.

Download

The latest version of File::Tail (file-tail) can be found at

http://flori.github.com/file-tail

Installation

To install file-tail via its gem type:

gem install file-tail

Usage

File::Tail is a module in the File class. A lightweight class interface for logfiles can be seen under File::Tail::Logfile.

Direct extension of File objects with File::Tail works like that:

File.open(filename) do |log|
  log.extend(File::Tail)
  log.interval # 10
  log.backward(10)
  log.tail { |line| puts line }
end

It's also possible to mix File::Tail in your own File classes (see also File::Tail::Logfile):

class MyFile < File
  include File::Tail
end
log # MyFile.new("myfile")
log.interval # 10
log.backward(10)
log.tail { |line| print line }

The forward/backward method returns self, so it's possible to chain methods together like that:

log.backward(10).tail { |line| puts line }

A command line utility named rtail, that uses File::Tail is provided as well.

Documentation

To create the documentation of this module, type

$ rake doc

and the API documentation is generated.

In the examples direcotry is a small example of tail and pager program that use this module. You also may want look at the end of examples/tail.rb for a little example.

Author

Florian Frank mailto:[email protected]

License

Apache License, Version 2.0 – See the COPYING file in the source archive.

More Repositories

1

json

JSON implementation for Ruby
Ruby
665
star
2

amatch

Approximate String Matching library
C
364
star
3

term-ansicolor

Ruby library that colors strings using ANSI escape sequences
Ruby
168
star
4

permutation

Permutation library in Ruby
Ruby
29
star
5

more_math

Library that provides more mathematics.
Ruby
27
star
6

neuro

Neural Network Extension for Ruby
Ruby
21
star
7

tins

This Is Not Spruz
Ruby
20
star
8

protocol

Method Protocols for Ruby Classes
Ruby
15
star
9

spruz

All the stuff that isn't good/big enough for a real library.
Ruby
15
star
10

bullshit

The Bullshit Benchmarking Library provides the means to measure, analyse, compare, and report the execution time of ruby code. It also provides statistical tests and values computed from the measured data.
Ruby
12
star
11

lazylist

Implementation of lazy lists for Ruby
Ruby
9
star
12

active_record_mutex

Implementation of a Mutex for Active Record
Ruby
5
star
13

dslkit

Kit for building DSLs in Ruby
Ruby
4
star
14

cpu

Ruby library to read Model Specific Registers, e. g. core temperature, via the msr linux kernel module
Ruby
3
star
15

vim-config

My vim configuration
Vim Script
3
star
16

utils

Ruby
3
star
17

gem_hadar

Library providing a bunch of rake tasks for handling gems
Ruby
3
star
18

mize

Memoize methods/functions in Ruby
Ruby
3
star
19

blinkenlights

Control the Blinkenlights on your keyboard from Ruby
Ruby
2
star
20

jsturtle

Turtle Graphics with Javascript and Canvas
JavaScript
1
star
21

wirecard_checkout_page

Ruby
1
star
22

complex_config

configuration library using YAML
Ruby
1
star
23

caddy-stats

Go
1
star
24

docker-tinyproxy

Makefile
1
star
25

hackmac

Some ruby tools for working with a Hackintosh, which also might be (partially) useful an a regular Mac.
Ruby
1
star
26

ctapi

Ruby extension for Chipcard Cardterminal-API (CTAPI)
Ruby
1
star
27

kramdown-ansi

A library for rendering Markdown(ish) documents with beautiful ANSI escape sequences in the terminal.
Ruby
1
star