Class: MongoidFixtures::Loader
- Inherits:
-
Object
- Object
- MongoidFixtures::Loader
- Includes:
- Singleton
- Defined in:
- lib/mongoid_fixtures.rb
Instance Attribute Summary collapse
-
#fixtures ⇒ Object
Returns the value of attribute fixtures.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Loader
constructor
A new instance of Loader.
Constructor Details
#initialize ⇒ Loader
Returns a new instance of Loader.
16 17 18 |
# File 'lib/mongoid_fixtures.rb', line 16 def initialize @fixtures = {} end |
Instance Attribute Details
#fixtures ⇒ Object
Returns the value of attribute fixtures.
14 15 16 |
# File 'lib/mongoid_fixtures.rb', line 14 def fixtures @fixtures end |
#path ⇒ Object
Returns the value of attribute path.
14 15 16 |
# File 'lib/mongoid_fixtures.rb', line 14 def path @path end |
Class Method Details
.load ⇒ Object
20 21 22 |
# File 'lib/mongoid_fixtures.rb', line 20 def self.load load_fixtures Dir[File.join(File.('../..', __FILE__), "#{path}/*.yml")] end |
.load_fixtures(fixture_names) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/mongoid_fixtures.rb', line 24 def self.load_fixtures(fixture_names) fix = MongoidFixtures::Loader.instance fixture_names.each do |fixture| fix.fixtures[File.basename(fixture, '.*')] = YAML.load_file(fixture) end fix end |
.path ⇒ Object
36 37 38 |
# File 'lib/mongoid_fixtures.rb', line 36 def self.path Loader.instance.path end |
.path=(var) ⇒ Object
32 33 34 |
# File 'lib/mongoid_fixtures.rb', line 32 def self.path=(var) Loader.instance.path = var end |