Class: CouchRest::Callbacks::CallbackChain

Inherits:
Array
  • Object
show all
Defined in:
lib/couchrest/mixins/callbacks.rb

Overview

An Array with a compile method

Instance Method Summary collapse

Instance Method Details

#clone(klass) ⇒ Object



322
323
324
# File 'lib/couchrest/mixins/callbacks.rb', line 322

def clone(klass)
  CallbackChain.new(map {|c| c.clone(klass)})
end

#compile(key = nil, object = nil) ⇒ Object



310
311
312
313
314
315
316
317
318
319
320
# File 'lib/couchrest/mixins/callbacks.rb', line 310

def compile(key = nil, object = nil)
  method = []
  each do |callback|
    method << callback.start(key, object)
  end
  method << "yield self"
  reverse_each do |callback|
    method << callback.end(key, object)
  end
  method.compact.join("\n")
end