class Realize::Format::Split

Take a string value and split it on the specified 'by' value. By default, it will be split on a blank space. For example: '123 456 789' would yield ['123', '456', '789']. If the value is not a string then it will be converted to a string by calling to_s on it.

Constants

DEFAULT_BY

Attributes

by[R]

Public Class Methods

new(by: DEFAULT_BY) click to toggle source
# File lib/realize/format/split.rb, line 22
def initialize(by: DEFAULT_BY)
  @by = by.to_s

  freeze
end

Public Instance Methods

transform(_resolver, value, _time, _record) click to toggle source
# File lib/realize/format/split.rb, line 28
def transform(_resolver, value, _time, _record)
  value.to_s.split(by)
end