Module: TFBoy

Defined in:
lib/test_fixture_boy.rb

Overview

TFBoy is a utility to copy ActiveRecords from you data base and print out a Fixture file if you want.

The current supported output file formats are:

  • yaml

Class Method Summary collapse

Class Method Details

.except(attrs) ⇒ Object



32
33
34
# File 'lib/test_fixture_boy.rb', line 32

def self.except(attrs)
  scanner.except(attrs)
end


36
37
38
39
40
41
42
43
44
45
46
# File 'lib/test_fixture_boy.rb', line 36

def self.print(format)
  # Grab all the copied data from scanner
  copy_data =
    case format
    when :yaml
      scanner.print_yaml
    end
  copy_data[:format] = format
  printer = Printer.new copy_data
  printer.print
end

.scan(clear_cache = false) ⇒ Object



24
25
26
# File 'lib/test_fixture_boy.rb', line 24

def self.scan(clear_cache = false)
  scanner.scan(clear_cache) { yield }
end

.scannerObject



19
20
21
22
# File 'lib/test_fixture_boy.rb', line 19

def self.scanner
  puts "scanner"
  @scanner ||= RecordScanner.new
end

.select(attrs) ⇒ Object



28
29
30
# File 'lib/test_fixture_boy.rb', line 28

def self.select(attrs)
  scanner.select(attrs)
end

.show_timeObject



48
49
50
# File 'lib/test_fixture_boy.rb', line 48

def self.show_time
  TestFixtureBoy::Talents.introduce
end