class SimpleParams::Formatter
Public Class Methods
new(attribute, formatter)
click to toggle source
# File lib/simple_params/formatter.rb, line 7 def initialize(attribute, formatter) @attribute = attribute @formatter = formatter end
Public Instance Methods
format(value)
click to toggle source
# File lib/simple_params/formatter.rb, line 12 def format(value) if @formatter.is_a?(Proc) @formatter.call(@attribute, value) else @attribute.send(@formatter, value) end end