Class | Plucky::Normalizers::OptionsHashValue |
In: |
lib/plucky/normalizers/options_hash_value.rb
|
Parent: | Object |
Public: Initialize an OptionsHashValue.
args - The hash of arguments (default: {})
:key_normalizer - The key normalizer to use, must respond to call :value_normalizers - Hash where key is name of options hash key to normalize and value is what should be used to normalize the value accordingly (must respond to call). Allows adding normalizers for new keys and overriding existing default normalizers.
Examples
Plucky::Normalizers::OptionsHashValue.new({ :key_normalizer => lambda { |key| key}, # key normalizer must responds to call :value_normalizers => { :new_key => lambda { |key| key.to_s.upcase }, # add normalizer for :new_key :fields => lambda { |key| key }, # override normalizer for fields to one that does nothing } })
Returns the duplicated String.