class Croesus::Coercion
This wraps the block that is provided when you register a coercion.
Constants
- PASS_THROUGH
Just passes the object on through
Public Class Methods
new(origin, target, &block)
click to toggle source
@param origin [Class] the class that the object is @param target [Class] the class you wish to coerce to
# File lib/croesus/coerce.rb, line 71 def initialize(origin, target, &block) @origin = origin @target = target @block = block_given? ? block : PASS_THROUGH end
Public Instance Methods
call(object)
click to toggle source
Calls the coercion
@return [Object]
# File lib/croesus/coerce.rb, line 80 def call(object) @block.call(object, @target) end