Class: Paradocs::Registry
Instance Attribute Summary collapse
-
#policies ⇒ Object
readonly
Returns the value of attribute policies.
Instance Method Summary collapse
- #coercions ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #policy(name, plcy = nil, &block) ⇒ Object
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
9 10 11 |
# File 'lib/paradocs/registry.rb', line 9 def initialize @policies = {} end |
Instance Attribute Details
#policies ⇒ Object (readonly)
Returns the value of attribute policies.
7 8 9 |
# File 'lib/paradocs/registry.rb', line 7 def policies @policies end |
Instance Method Details
#coercions ⇒ Object
13 14 15 |
# File 'lib/paradocs/registry.rb', line 13 def coercions policies end |
#policy(name, plcy = nil, &block) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/paradocs/registry.rb', line 17 def policy(name, plcy = nil, &block) validate_policy_class(plcy) if plcy policies[name] = (plcy || BasePolicy.build(name, :instance_eval, &block)) self end |