Class: CouchTap::Destroyers::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/couch_tap/destroyers/collection.rb

Overview

Collection Destroyer. Go through each sub-table definition and remove all references to the parent document.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, opts = {}, &block) ⇒ Collection

Returns a new instance of Collection.



14
15
16
17
18
19
# File 'lib/couch_tap/destroyers/collection.rb', line 14

def initialize(parent, opts = {}, &block)
  @_tables = []
  @parent  = parent

  instance_eval(&block)
end

Instance Attribute Details

#parentObject (readonly)

Returns the value of attribute parent.



12
13
14
# File 'lib/couch_tap/destroyers/collection.rb', line 12

def parent
  @parent
end

Instance Method Details

#executeObject



21
22
23
24
25
26
# File 'lib/couch_tap/destroyers/collection.rb', line 21

def execute
  # Just go through each table and ask it to execute itself
  @_tables.each do |table|
    table.execute
  end
end

#table(name, opts = {}, &block) ⇒ Object

DSL Methods



30
31
32
# File 'lib/couch_tap/destroyers/collection.rb', line 30

def table(name, opts = {}, &block)
  @_tables << Table.new(parent, name, opts, &block)
end