Module: SfnParameters::Utils
- Defined in:
- lib/sfn-parameters/utils.rb
Overview
Common helper methods
Instance Method Summary collapse
-
#lock_content(content) ⇒ Hash
Lock the given content.
-
#unlock_content(content) ⇒ Hash
Unlock given content.
Instance Method Details
#lock_content(content) ⇒ Hash
Lock the given content
11 12 13 14 15 16 17 18 |
# File 'lib/sfn-parameters/utils.rb', line 11 def lock_content(content) content = content.to_smash content.merge!(:sfn_lock_enabled => true) safe = SfnParameters::Safe.build( config.fetch(:sfn_parameters, :safe, Smash.new) ) safe.lock(dump_json(content)) end |
#unlock_content(content) ⇒ Hash
Unlock given content
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sfn-parameters/utils.rb', line 24 def unlock_content(content) content = content.to_smash if content[:sfn_parameters_lock] safe = SfnParameters::Safe.build( config.fetch(:sfn_parameters, :safe, Smash.new) ) load_json(safe.unlock(content)).to_smash.merge(:sfn_lock_enabled => true) else content end end |