module Augmented::Hashes::Transformable::Helpers

Public Class Methods

make_one_proc(thing) click to toggle source
# File lib/augmented/hashes/transformable.rb, line 48
def self.make_one_proc thing
  if thing.kind_of?(Array)
    thing.map(&:to_proc).reduce{ |chain, proc| chain | proc }
  else
    thing.to_proc
  end
end
validate!(transforms) click to toggle source
# File lib/augmented/hashes/transformable.rb, line 56
def self.validate! transforms
  unless transforms.respond_to? :each_pair
    raise ArgumentError, 'transformations must be specified in a map-like collection (must have `each_pair` enumerator)'
  end
end