Module: Sevgi::Function

Extended by:
Color, File, Math, Pluralize, Shell, String, UI
Defined in:
lib/sevgi/function.rb,
lib/sevgi/function/ui.rb,
lib/sevgi/function/file.rb,
lib/sevgi/function/math.rb,
lib/sevgi/function/color.rb,
lib/sevgi/function/shell.rb,
lib/sevgi/function/locate.rb,
lib/sevgi/function/string.rb,
lib/sevgi/function/version.rb

Overview

Shared helper namespace used directly as Sevgi::Function and through F.

Examples:

Use helper methods through the public alias

F.pluralize("axis")

Defined Under Namespace

Modules: Color, File, Math, Pluralize, Shell, String, UI Classes: Locate, Location

Constant Summary collapse

VERSION =

Current version of the Sevgi function gem.

"0.94.0"

Constants included from Math

Math::PRECISION

Constants included from Pluralize

Pluralize::IRREGULARS, Pluralize::PLURALS, Pluralize::RULES, Pluralize::UNCOUNTABLES

Class Method Summary collapse

Methods included from UI

do, mayok, notok, ok, ui

Methods included from File

changed?, existing, existing!, existing_map, existing_map!, out, qualify, subext, touch

Methods included from Math

acos, acot, approx, asin, atan, atan2, cos, cot, count, eq?, ge?, gt?, le?, lt?, precision, precision=, round, sin, tan, to_degrees, to_radians, with_precision, zero?

Methods included from Color

blue, bold, cyan, dim, green, magenta, red, yellow

Methods included from Shell

executable!, executable?, sh, sh!

Methods included from String

demodulize

Methods included from Pluralize

pluralize

Class Method Details

.locate(filename, start, exclude: nil, extension: EXTENSION) ⇒ Sevgi::Function::Location

Locates a Sevgi-related file by walking upward from a start directory.

Parameters:

  • filename (String)

    file name or extensionless basename

  • start (String)

    directory where lookup starts

  • exclude (Array<String>, String, nil) (defaults to: nil)

    paths ignored during lookup

  • extension (String) (defaults to: EXTENSION)

    default extension added before lookup

Returns:

Raises:



107
108
109
110
111
# File 'lib/sevgi/function/locate.rb', line 107

def self.locate(filename, start, exclude: nil, extension: EXTENSION)
  Locate.(F.qualify(filename, extension), start, exclude:).tap do |path|
    Error.("Cannot load a file matching: #{filename}") unless path
  end
end