Class: Parametric::Registry
- Inherits:
-
Object
- Object
- Parametric::Registry
- Defined in:
- lib/parametric/registry.rb
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/parametric/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/parametric/registry.rb', line 7 def policies @policies end |
Instance Method Details
#coercions ⇒ Object
13 14 15 |
# File 'lib/parametric/registry.rb', line 13 def coercions policies end |
#policy(name, plcy = nil, &block) ⇒ Object
17 18 19 20 |
# File 'lib/parametric/registry.rb', line 17 def policy(name, plcy = nil, &block) policies[name] = (plcy || BlockValidator.build(:instance_eval, &block)) self end |