module Rehash

Constants

VERSION

Public Instance Methods

default_options(value = nil) click to toggle source
# File lib/rehash.rb, line 11
def default_options(value = nil)
  return @@default_options if value.nil?

  @@default_options = @@default_options.merge(value).freeze
end
map(hash, opts_or_mapping = {}) { |mapper| ... } click to toggle source
# File lib/rehash.rb, line 17
def map(hash, opts_or_mapping = {})
  if block_given?
    mapper = Mapper.new(hash, default_options.merge(opts_or_mapping))
    yield mapper
    mapper.result
  else
    Mapper.new(hash).(opts_or_mapping)
  end
end
map_with(opts_or_mapping = {}, &block) click to toggle source
# File lib/rehash/refinement.rb, line 3
def map_with(opts_or_mapping = {}, &block)
  ::Rehash.map(self, opts_or_mapping, &block)
end