class HumanAttributes::Formatters::Custom

Attributes

formatter[R]

Public Class Methods

new(attribute, type, options) click to toggle source
Calls superclass method HumanAttributes::Formatters::Base::new
# File lib/human_attributes/formatters/custom.rb, line 6
def initialize(attribute, type, options)
  @formatter = options[:formatter]
  raise_error('MissingFormatterOption') unless formatter.is_a?(Proc)
  super
end

Public Instance Methods

apply(instance, value) click to toggle source
# File lib/human_attributes/formatters/custom.rb, line 12
def apply(instance, value)
  formatter.call(instance, value)
end