Class: FullMetalBody::DynamicWhitelistGenerator
- Inherits:
-
Object
- Object
- FullMetalBody::DynamicWhitelistGenerator
- Includes:
- InputKeyUtils
- Defined in:
- lib/full_metal_body/dynamic_whitelist_generator.rb
Defined Under Namespace
Classes: ParseArrayError
Instance Method Summary collapse
-
#execute! ⇒ ActiveSupport::HashWithIndifferentAccess
Dynamically generate a whitelist and return a merged one.
-
#initialize(keys, value, whitelist = {}) ⇒ DynamicWhitelistGenerator
constructor
A new instance of DynamicWhitelistGenerator.
Constructor Details
#initialize(keys, value, whitelist = {}) ⇒ DynamicWhitelistGenerator
Returns a new instance of DynamicWhitelistGenerator.
11 12 13 14 15 |
# File 'lib/full_metal_body/dynamic_whitelist_generator.rb', line 11 def initialize(keys, value, whitelist = {}) @keys = keys @value = value @whitelist = whitelist end |
Instance Method Details
#execute! ⇒ ActiveSupport::HashWithIndifferentAccess
Dynamically generate a whitelist and return a merged one.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/full_metal_body/dynamic_whitelist_generator.rb', line 19 def execute! if keys_isnt_whitelisted? if keys_include_array?(@keys) generate_whitelist_for_array(@keys) else @whitelist.bury!((@keys + ['type']), type_definition_by_value) end end @whitelist.with_indifferent_access end |