Module: ValueSemantics::ClassMethods
- Defined in:
- lib/value_semantics/class_methods.rb
Overview
All the class methods available on ValueSemantics classes
When a ValueSemantics module is included into a class, the class is extended by this module.
Instance Method Summary collapse
-
#coercer ⇒ #call
A coercer object for the value class.
-
#value_semantics ⇒ Recipe
The recipe used to build the ValueSemantics module that was included into this class.
Instance Method Details
#coercer ⇒ #call
A coercer object for the value class
This is mostly useful when nesting value objects inside each other.
30 31 32 |
# File 'lib/value_semantics/class_methods.rb', line 30 def coercer ValueObjectCoercer.new(self) end |
#value_semantics ⇒ Recipe
Returns the recipe used to build the ValueSemantics module that was included into this class.
13 14 15 16 17 18 19 20 |
# 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 |