Class: FixtureBot::TableLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/fixture_bot/table_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table) ⇒ TableLoader

Returns a new instance of TableLoader.



7
8
9
10
11
# File 'lib/fixture_bot/table_loader.rb', line 7

def initialize(table)
  @table = table
  @fixtures = []
  @fixtures_with_id = []
end

Instance Attribute Details

#fixturesObject (readonly)

Returns the value of attribute fixtures.



5
6
7
# File 'lib/fixture_bot/table_loader.rb', line 5

def fixtures
  @fixtures
end

#fixtures_with_idObject (readonly)

Returns the value of attribute fixtures_with_id.



5
6
7
# File 'lib/fixture_bot/table_loader.rb', line 5

def fixtures_with_id
  @fixtures_with_id
end

#tableObject (readonly)

Returns the value of attribute table.



5
6
7
# File 'lib/fixture_bot/table_loader.rb', line 5

def table
  @table
end

Instance Method Details

#fixture(name, &block) ⇒ Object



13
14
15
# File 'lib/fixture_bot/table_loader.rb', line 13

def fixture(name, &block)
  @fixtures << ["#{table}/#{name}", block]
end

#fixture_with_id(name, &block) ⇒ Object



17
18
19
# File 'lib/fixture_bot/table_loader.rb', line 17

def fixture_with_id(name, &block)
  @fixtures_with_id << ["#{table}/#{name}", block]
end