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.



3
4
5
# File 'lib/db_subsetter/filter.rb', line 3

def exporter=(value)
  @exporter = value
end

Instance Method Details

#filter(table, query) ⇒ Object



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

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



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

def ignore_tables
  []
end

#tablesObject



9
10
11
# File 'lib/db_subsetter/filter.rb', line 9

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