From 1dc8325d3f2458eb0cd53ea6e022554ab259d330 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Sun, 10 May 2009 14:23:48 -0700 Subject: [PATCH] [Sass] Get rid of the now-unused OrderedHash. --- lib/sass/css.rb | 55 ------------------------------------------------- 1 file changed, 55 deletions(-) diff --git a/lib/sass/css.rb b/lib/sass/css.rb index 0fbe29ce..05864925 100644 --- a/lib/sass/css.rb +++ b/lib/sass/css.rb @@ -42,61 +42,6 @@ module Sass end end - # This class is based on the Ruby 1.9 ordered hashes. - # It keeps the semantics and most of the efficiency of normal hashes - # while also keeping track of the order in which elements were set. - class OrderedHash - Node = Struct.new(:key, :value, :next, :prev) - include Enumerable - - def initialize - @hash = {} - end - - def initialize_copy(other) - @hash = other.instance_variable_get('@hash').clone - end - - def [](key) - @hash[key] && @hash[key].value - end - - def []=(key, value) - node = Node.new(key, value) - - if old = @hash[key] - if old.prev - old.prev.next = old.next - else # old is @first and @last - @first = @last = nil - end - end - - if @first.nil? - @first = @last = node - else - node.prev = @last - @last.next = node - @last = node - end - - @hash[key] = node - value - end - - def each - return unless @first - yield [@first.key, @first.value] - node = @first - yield [node.key, node.value] while node = node.next - self - end - - def values - self.map { |k, v| v } - end - end - # :startdoc: # This class contains the functionality used in the +css2sass+ utility,