Class: Zygote::Identifier
- Inherits:
-
Object
- Object
- Zygote::Identifier
- Defined in:
- lib/zygote/identifier.rb
Overview
Provides a hook for identifiers to alter boot-time behavior To do so, extend this class with a new identify method. You may NOT define more than one identifier - the last one wins. class MyIdentifier < Zygote::Identifier
def identify
mutate_params(@params)
end
end
Class Method Summary collapse
Instance Method Summary collapse
-
#identify ⇒ Object
Called only if this class is never subclassed.
-
#initialize(params) ⇒ Identifier
constructor
A new instance of Identifier.
Constructor Details
#initialize(params) ⇒ Identifier
Returns a new instance of Identifier.
26 27 28 |
# File 'lib/zygote/identifier.rb', line 26 def initialize(params) @params = params end |
Class Method Details
.identify(params) ⇒ Object
16 17 18 19 |
# File 'lib/zygote/identifier.rb', line 16 def identify(params) @identifier ||= self @identifier.new(params).identify end |
.inherited(subclass) ⇒ Object
12 13 14 |
# File 'lib/zygote/identifier.rb', line 12 def inherited(subclass) @identifier = subclass end |
.reset! ⇒ Object
21 22 23 |
# File 'lib/zygote/identifier.rb', line 21 def reset! @identifier = self end |
Instance Method Details
#identify ⇒ Object
Called only if this class is never subclassed
31 32 33 |
# File 'lib/zygote/identifier.rb', line 31 def identify @params end |