class Representable::Coercion::Coercer

Public Class Methods

new(type) click to toggle source
# File lib/representable/coercion.rb, line 6
def initialize(type)
  @type = type
end

Public Instance Methods

call(value, doc, options) click to toggle source

This gets called when the :render_filter or :parse_filter option is evaluated. Usually the Coercer instance is an element in a Pipeline to allow >1 filters per property.

# File lib/representable/coercion.rb, line 12
def call(value, doc, options)
  Virtus::Attribute.build(@type).coerce(value)
end