Module: Sevgi::Wet

Included in:
Sevgi
Defined in:
lib/sevgi/graphics/internal/wet.rb

Constant Summary collapse

EMPTY_ARRAY =

Copied from github.com/dry-rb/dry-core. All kudos to the original authors.

[].freeze
EMPTY_HASH =
{}.freeze
EMPTY_OPTS =
{}.freeze
EMPTY_STRING =
""
IDENTITY =
(->(x) { x }).freeze
Undefined =

rubocop:disable Metrics/BlockLength

Object.new.tap do |undefined| # rubocop:disable Metrics/BlockLength
  const_set(:Self, -> { Undefined })

  def undefined.to_s                 = "Undefined"

  def undefined.inspect              = "Undefined"

  def undefined.default(x, y = self) = equal?(x) ? (equal?(y) ? yield : y) : x

  def undefined.map(value)           = equal?(value) ? self : yield(value)

  def undefined.dup                  = self

  def undefined.clone                = self

  def undefined.coalesce(*args)      = args.find(Self) { |x| !equal?(x) }
end.freeze
Function =
Module.new
F =
Function

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



43
44
45
46
47
# File 'lib/sevgi/graphics/internal/wet.rb', line 43

def self.included(base)
  super

  constants.each { |const_name| base.const_set(const_name, const_get(const_name)) }
end