Method: PlainText.head

Defined in:
lib/plain_text.rb

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

Module function of #head

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.

  • unit (Symbol, String)

    One of :line (or “-n”), :char, :byte (or “-c”)

  • 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



241
242
243
# File 'lib/plain_text.rb', line 241

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