Class: DbSubsetter::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/db_subsetter/filter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exporter=(value) ⇒ Object (writeonly)

Sets the attribute exporter

Parameters:

  • value

    the value to set the attribute exporter to.



5
6
7
# File 'lib/db_subsetter/filter.rb', line 5

def exporter=(value)
  @exporter = value
end

Instance Method Details

#filter(table, query) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/db_subsetter/filter.rb', line 15

def filter(table, query)
  filter_method = "filter_#{table.downcase}"
  if self.respond_to? filter_method
    self.send(filter_method, query)
  else
    query
  end
end

#ignore_tablesObject



7
8
9
# File 'lib/db_subsetter/filter.rb', line 7

def ignore_tables
  []
end

#tablesObject



11
12
13
# File 'lib/db_subsetter/filter.rb', line 11

def tables
  @exporter.all_tables - ActiveRecord::SchemaDumper.ignore_tables - ignore_tables
end