Permalink
Browse files

Removed Machinist::Warehouse - left over from 2839888.

  • Loading branch information...
1 parent 0b00fd1 commit 4feabbf71224ef9f01125e362665ef0cbce86f70 @benhoskings benhoskings committed Feb 25, 2011
Showing with 0 additions and 36 deletions.
  1. +0 −36 lib/machinist/warehouse.rb
View
@@ -1,36 +0,0 @@
-module Machinist
-
- # A Warehouse is a hash supports lists as keys.
- #
- # It's used for storing cached objects created by Machinist::Shop.
- #
- # warehouse[1, 2] = "Hello, world!"
- # warehouse[1, 2] # => "Hello, world!"
- class Warehouse < Hash
-
- # Assign a value for the given list of keys.
- def []=(*keys)
- value = keys.pop
- super(keys, value)
- end
-
- # Return the value for the given list of keys.
- #
- # If the list of keys doesn't exist in the hash, this assigns a new empty
- # array to that list of keys.
- def [](*keys)
- self[*keys] = [] if !has_key?(keys)
- super(keys)
- end
-
- # Return a new warehouse with the same keys, and dups of all the values.
- def clone
- clone = Warehouse.new
- each_pair do |key, value|
- clone[*key] = value.dup
- end
- clone
- end
-
- end
-end

0 comments on commit 4feabbf

Please sign in to comment.