Method: PlainText.tail

Defined in:
lib/plain_text.rb

.tail(instr, *rest, **k) ⇒ Object

Module function of #tail

The return String includes PlainText as Singleton.

Parameters:

  • instr (String)

    String that is examined.

  • num_in (Integer, Regexp)

    Number (positive or negative, but not 0) of :unit to extract (Def: 10), or Regexp, which is valid only if unit is :line. If positive, the last num_in lines are returned. If negative, the lines from the num-in-th line from the head are returned. In short, calling this method as tail(3) and tail(-3) is similar to the UNIX commands “tail -n 3” and “tail -n +3”, respectively.

  • unit: (Symbol)

    One of :line (as in -n option), :char, :byte (-c option)

  • inclusive: (Boolean)

    read only when unit is :line. If inclusive (Default), the (entire) line that matches is included in the result.

  • linebreak: (String)

    \n etc (Default: $/), used when unit==:line (Default)

Returns:

  • as instr



272
273
274
# File 'lib/plain_text.rb', line 272

def self.tail(instr, *rest, **k)
  return PlainText.__call_inst_method__(:tail, instr, *rest, **k)
end