Ruby on Rails Thursday, April 26, 2012

what is in fixture.rb

def initialize(fixture, class_name)
case fixture
when Hash, YAML::Omap
@fixture = fixture
when String
@fixture = read_fixture_file(fixture)
else
raise ArgumentError, "Bad fixture argument #{fixture.inspect}
"Line no 770" during creation of #{class_name} fixture"
end

@class_name = class_name
end

def each
@fixture.each { |item| yield item }
end

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

def to_hash
@fixture
end

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment