Class: CouchRest::Mixins::Callbacks::CallbackChain
- Inherits:
-
Array
- Object
- Array
- CouchRest::Mixins::Callbacks::CallbackChain
- Defined in:
- lib/couchrest/mixins/callbacks.rb
Overview
An Array with a compile method
Instance Method Summary (collapse)
- - (Object) clone(klass)
- - (Object) compile(key = nil, options = {})
-
- (CallbackChain) initialize(symbol)
constructor
A new instance of CallbackChain.
Constructor Details
- (CallbackChain) initialize(symbol)
A new instance of CallbackChain
349 350 351 |
# File 'lib/couchrest/mixins/callbacks.rb', line 349 def initialize(symbol) @symbol = symbol end |
Instance Method Details
- (Object) clone(klass)
366 367 368 369 |
# File 'lib/couchrest/mixins/callbacks.rb', line 366 def clone(klass) chain = CallbackChain.new(@symbol) chain.push(*map {|c| c.clone(klass)}) end |
- (Object) compile(key = nil, options = {})
353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/couchrest/mixins/callbacks.rb', line 353 def compile(key = nil, = {}) method = [] method << "halted = false" each do |callback| method << callback.start(key, ) end method << "yield self if block_given? && !halted" reverse_each do |callback| method << callback.end(key, ) end method.compact.join("\n") end |