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



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

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

.for_typeObject



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

def self.for_type = ::String

.helperObject



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

def self.helper = false