class Stockboy::Translations::Integer
Translate string values to Integer
Job
template DSL
¶ ↑
Registered as :integer
. Use with:
attributes do children as: :integer end
@example
num = Stockboy::Translator::Integer.new record.children = "2" num.translate(record, :children) # => 2
Public Instance Methods
translate(context)
click to toggle source
@return [Integer]
# File lib/stockboy/translations/integer.rb, line 25 def translate(context) value = field_value(context, field_key) return nil if value.blank? value.to_i end