Class: Fixture

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/fixtures.rb

Overview

:nodoc:

Direct Known Subclasses

YamlFixture

Instance Method Summary collapse

Constructor Details

#initialize(fixture_path, file) ⇒ Fixture

Returns a new instance of Fixture.



119
120
121
122
# File 'lib/active_record/fixtures.rb', line 119

def initialize(fixture_path, file)
  @fixture_path, @file = fixture_path, file
  @fixture = read_fixture
end

Instance Method Details

#[](key) ⇒ Object



124
125
126
# File 'lib/active_record/fixtures.rb', line 124

def [](key)
  @fixture[key]
end

#key_listObject



132
133
134
# File 'lib/active_record/fixtures.rb', line 132

def key_list
  @fixture.keys.join(", ")
end

#to_hashObject



128
129
130
# File 'lib/active_record/fixtures.rb', line 128

def to_hash
  @fixture
end

#value_listObject



136
137
138
# File 'lib/active_record/fixtures.rb', line 136

def value_list
  @fixture.values.map { |v| "'#{v}'" }.join(", ")
end