Module: Assertion::List Private

Extended by:
Transproc::Registry
Defined in:
lib/assertion/transprocs/list.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

The collection of pure functions for converting arrays

Instance Method Summary collapse

Instance Method Details

#symbolize(array) ⇒ Array<Symbol>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Converts the nested array of strings and symbols into the flat array of unique symbols

Examples:

fn = List[:symbolize]
source = [:foo, ["foo", "bar"], :bar, "baz"]
fn[source]
# => [:foo, :bar, :baz]

Parameters:

  • array (Array<String, Symbol, Array>)

Returns:

  • (Array<Symbol>)


24
25
26
# File 'lib/assertion/transprocs/list.rb', line 24

def symbolize(array)
  array.flatten.map(&:to_sym).uniq
end