Sha256: 2e7e3eee8081336bf755d65e93dbe1a66b864f03bdb6e7f7e97a053cd1f1e45b

Contents?: true

Size: 650 Bytes

Versions: 2

Compression:

Stored size: 650 Bytes

Contents

# Additional classes 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
class Fixture
	def has_key?(key)
		# should work for Hash and Omap
		@fixture.keys.include?(key)
	end
	
	def each_pair(&block)
		if @fixture.respond_to?(:each_pair) 
			# for Hash
			@fixture.each_pair(&block)
		else
			# for Omap
			@fixture.map { |k, v| yield(k,v) } 
		end
	end
	
	def delete_if(&block)
		# should work for Hash and Omap
		@fixture.delete_if(&block)
	end
	
	def []=(key, value)
		@fixture[key] = value
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
joinfix-0.1.0 lib/joinfix/fixture.rb
joinfix-0.1.1 lib/joinfix/fixture.rb