module ValueSemantics::ClassMethods

All the class methods available on ValueSemantics classes

When a ValueSemantics module is included into a class, the class is extended by this module.

Public Instance Methods

coercer() click to toggle source

A coercer object for the value class

This is mostly useful when nesting value objects inside each other.

@return [#call] A callable object that can be used as a coercer @see ValueObjectCoercer

# File lib/value_semantics/class_methods.rb, line 30
def coercer
  ValueObjectCoercer.new(self)
end
value_semantics() click to toggle source

@return [Recipe] the recipe used to build the ValueSemantics module that

was included into this class.
# File lib/value_semantics/class_methods.rb, line 13
def value_semantics
  if block_given?
    # caller is trying to use the monkey-patched Class method
    raise "`#{self}` has already included ValueSemantics"
  end

  self::VALUE_SEMANTICS_RECIPE__
end