lib/joinfix/fixture.rb in joinfix-0.1.1 vs lib/joinfix/fixture.rb in joinfix-1.0.0
- old
+ new
@@ -1,9 +1,8 @@
-# Additional classes to make Fixture behave like a Hash. Required for resolving joins.
+# Defines additional methods to make Fixture behave like a Hash. Required for resolving joins.
#
-# Just off of trivial because the internal data structure for Fixture can be a Hash or
-# a YAML::Omap
+# Accomodates both of the allowed internal data structures for Fixture: Hash and YAML::Omap
class Fixture
def has_key?(key)
# should work for Hash and Omap
@fixture.keys.include?(key)
end
@@ -12,10 +11,10 @@
if @fixture.respond_to?(:each_pair)
# for Hash
@fixture.each_pair(&block)
else
# for Omap
- @fixture.map { |k, v| yield(k,v) }
+ @fixture.map { |key, value| yield(key, value) }
end
end
def delete_if(&block)
# should work for Hash and Omap
\ No newline at end of file