Class: Parametric::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/parametric/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



9
10
11
# File 'lib/parametric/registry.rb', line 9

def initialize
  @policies = {}
end

Instance Attribute Details

#policiesObject (readonly)

Returns the value of attribute policies.



7
8
9
# File 'lib/parametric/registry.rb', line 7

def policies
  @policies
end

Instance Method Details

#coercionsObject



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