Module: Sevgi
- Defined in:
- lib/sevgi/core.rb,
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
Defined Under Namespace
Modules: Function Classes: Error, MissingComponentError
Constant Summary collapse
- ENVVOMIT =
Environment variable that asks command-line tools to re-raise captured errors.
"SEVGI_VOMIT"- EXTENSION =
Default file extension for Sevgi scripts.
"sevgi"- PanicError =
Error raised for internal invariants and implementation paths that should be unreachable.
Class.new(Error)
- ArgumentError =
Error raised for invalid public API usage.
Class.new(Error)
- EMPTY_ARRAY =
Shared immutable empty array.
[].freeze
- EMPTY_HASH =
Shared immutable empty hash.
{}.freeze
- EMPTY_OPTS =
Shared immutable empty options hash.
{}.freeze
- EMPTY_STRING =
Shared empty string.
""- IDENTITY =
Identity callable.
-> (x) { x }.freeze
- Undefined =
Sentinel object used to distinguish an omitted value from nil.
Object .new .tap do |undefined| const_set(:Self, -> { Undefined }) # Returns the sentinel name. # @return [String] def undefined.to_s = "Undefined" # Returns the sentinel inspection string. # @return [String] def undefined.inspect = "Undefined" # Resolves a value unless it is {Sevgi::Undefined}. # @param x [Object] candidate value # @param y [Object] fallback value # @yield computes the fallback when both x and y are undefined # @yieldreturn [Object] # @return [Object] x, y, or the yielded fallback def undefined.default(x, y = self) return x unless equal?(x) equal?(y) ? yield : y end # Maps a value unless it is {Sevgi::Undefined}. # @param value [Object] candidate value # @yield maps a defined value # @yieldparam value [Object] the defined value # @yieldreturn [Object] # @return [Object] the sentinel or the mapped value def undefined.map(value) = equal?(value) ? self : yield(value) # Returns the sentinel itself. # @return [Sevgi::Undefined] def undefined.dup = self # Returns the sentinel itself. # @return [Sevgi::Undefined] def undefined.clone = self # Returns the first argument that is not {Sevgi::Undefined}. # @param args [Array<Object>] candidate values # @return [Object, nil] first defined value, including nil, or nil when none exists def undefined.coalesce(*args) = args.find(Self) { |x| !equal?(x) } end .freeze
- F =
Public alias for the shared function helper namespace.
Function