Module: ActiveInteraction::Extras::FilterExtensions::HashAutoStrip

Defined in:
lib/active_interaction/extras/filter_extensions/hash_auto_strip.rb

Overview

If hash specified without structure automatically accept full hash

Examples:

Accept all keys

hash :options

Accept only specified keys

hash :options do
  string :name
end

Accept all keys

hash :options, strip: false do
  string :name
end

Instance Method Summary collapse

Instance Method Details

#initializeObject



19
20
21
22
# File 'lib/active_interaction/extras/filter_extensions/hash_auto_strip.rb', line 19

def initialize(*)
  super
  options[:strip] = false if !block_given? && !options.key?(:strip)
end