class Garcon::Coercion

This wraps the block that is provided when you register a coercion.

Constants

PASS_THROUGH

Passes the object on through.

Public Class Methods

new(origin, target, &block) click to toggle source

@param [Class] origin

The class that the object is.

@param [Class] target

The class you wish to coerce to.
# File lib/garcon/chef/coerce/coercer.rb, line 97
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/garcon/chef/coerce/coercer.rb, line 107
def call(object)
  @block.call(object, @target)
end