Module: Protector
- Defined in:
- lib/protector.rb,
lib/protector/dsl.rb,
lib/protector/engine.rb,
lib/protector/version.rb,
lib/protector/adapters/sequel.rb,
lib/protector/adapters/sequel/model.rb,
lib/protector/adapters/active_record.rb,
lib/protector/adapters/sequel/dataset.rb,
lib/protector/adapters/active_record/base.rb,
lib/protector/adapters/active_record/relation.rb,
lib/protector/adapters/active_record/preloader.rb,
lib/protector/adapters/active_record/association.rb,
lib/protector/adapters/active_record/validations.rb,
lib/protector/adapters/sequel/eager_graph_loader.rb,
lib/protector/adapters/active_record/collection_proxy.rb,
lib/protector/adapters/active_record/strong_parameters.rb,
lib/protector/adapters/active_record/singular_association.rb
Defined Under Namespace
Modules: ActiveRecord, Adapters, DSL Classes: Config, Engine
Constant Summary collapse
- ADAPTERS =
[ Protector::Adapters::ActiveRecord, Protector::Adapters::Sequel ]
- VERSION =
Gem version
'0.7.6'
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
- .activate! ⇒ Object
-
.insecurely(&block) ⇒ Object
Allows executing any code having Protector globally disabled.
- .paranoid= ⇒ Object
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
20 21 22 |
# File 'lib/protector.rb', line 20 def config @config end |
Class Method Details
.activate! ⇒ Object
41 42 43 |
# File 'lib/protector.rb', line 41 def activate! ADAPTERS.each { |adapter| adapter.activate! } end |
.insecurely(&block) ⇒ Object
Allows executing any code having Protector globally disabled
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/protector.rb', line 27 def insecurely(&block) Thread.current[:protector_disabled_nesting] ||= 0 Thread.current[:protector_disabled_nesting] += 1 Thread.current[:protector_disabled] = true yield ensure Thread.current[:protector_disabled_nesting] -= 1 if Thread.current[:protector_disabled_nesting] == 0 Thread.current[:protector_disabled] = false end end |
.paranoid= ⇒ Object
22 23 24 |
# File 'lib/protector.rb', line 22 def paranoid= '`Protector.paranoid = ...` is deprecated! Please change it to `Protector.config.paranoid = ...`' end |