class Stockboy::Translations::String
Cleans string values by stripping surrounding whitespace
Job
template DSL
¶ ↑
Registered as :string
. Use with:
attributes do name as: :string end
@example
str = Stockboy::Translator::String.new record.name = "Arthur " str.translate(record, :name) # => "Arthur"
Public Instance Methods
translate(context)
click to toggle source
@return [String]
# File lib/stockboy/translations/string.rb, line 25 def translate(context) value = field_value(context, field_key) return "" if value.nil? value.to_s.strip end