Class: ActiveRecord::FixtureSet::File

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
activerecord/lib/active_record/fixture_set/file.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Enumerable

#as_json, #compact_blank, #exclude?, #excluding, #including, #index_by, #index_with, #many?, #pluck, #sum, #without

Constructor Details

#initialize(file) ⇒ File

Returns a new instance of File.



20
21
22
# File 'activerecord/lib/active_record/fixture_set/file.rb', line 20

def initialize(file)
  @file = file
end

Class Method Details

.open(file) ⇒ Object

Open a fixture file named file. When called with a block, the block is called with the filehandle and the filehandle is automatically closed when the block finishes.



15
16
17
18
# File 'activerecord/lib/active_record/fixture_set/file.rb', line 15

def self.open(file)
  x = new file
  block_given? ? yield(x) : x
end

Instance Method Details

#each(&block) ⇒ Object



24
25
26
# File 'activerecord/lib/active_record/fixture_set/file.rb', line 24

def each(&block)
  rows.each(&block)
end

#ignored_fixturesObject



32
33
34
# File 'activerecord/lib/active_record/fixture_set/file.rb', line 32

def ignored_fixtures
  config_row["ignore"]
end

#model_classObject



28
29
30
# File 'activerecord/lib/active_record/fixture_set/file.rb', line 28

def model_class
  config_row["model_class"]
end