Module: Plumb::SplitPolicy

Defined in:
lib/plumb/types.rb

Overview

Split a string into an array. Default separator is /s*,s*/ Usage:

type = Types::String.split
type.parse('a,b,c') # => ['a', 'b', 'c']

Custom separator:

type = Types::String.split(';')

Constant Summary collapse

DEFAULT_SEPARATOR =
/\s*,\s*/

Class Method Summary collapse

Class Method Details

.call(type, separator = DEFAULT_SEPARATOR) ⇒ Object



132
133
134
# File 'lib/plumb/types.rb', line 132

def self.call(type, separator = DEFAULT_SEPARATOR)
  type.invoke(:split, separator) >> Types::Array[String]
end

.for_typeObject



136
# File 'lib/plumb/types.rb', line 136

def self.for_type = ::String

.helperObject



137
# File 'lib/plumb/types.rb', line 137

def self.helper = false