diff --git a/lib/haml/buffer.rb b/lib/haml/buffer.rb index 193adf51..171a7e4e 100644 --- a/lib/haml/buffer.rb +++ b/lib/haml/buffer.rb @@ -201,7 +201,7 @@ RUBY def attributes(class_id, obj_ref, *attributes_hashes) attributes = class_id attributes_hashes.each do |old| - self.class.merge_attrs(attributes, to_hash(old.map {|k, v| [k.to_s, v]})) + self.class.merge_attrs(attributes, Hash[old.map {|k, v| [k.to_s, v]}]) end self.class.merge_attrs(attributes, parse_object_ref(obj_ref)) if obj_ref Compiler.build_attributes( diff --git a/lib/haml/util.rb b/lib/haml/util.rb index 7a4c343e..33f8628d 100755 --- a/lib/haml/util.rb +++ b/lib/haml/util.rb @@ -27,17 +27,6 @@ module Haml File.expand_path("../../../#{file}", __FILE__) end - # Converts an array of `[key, value]` pairs to a hash. - # - # @example - # to_hash([[:foo, "bar"], [:baz, "bang"]]) - # #=> {:foo => "bar", :baz => "bang"} - # @param arr [Array<(Object, Object)>] An array of pairs - # @return [Hash] A hash - def to_hash(arr) - Hash[arr.compact] - end - # Computes the powerset of the given array. # This is the set of all subsets of the array. # diff --git a/test/util_test.rb b/test/util_test.rb index 6bac1a16..a1bbeb85 100644 --- a/test/util_test.rb +++ b/test/util_test.rb @@ -20,14 +20,6 @@ class UtilTest < MiniTest::Unit::TestCase assert(File.exist?(scope("Rakefile"))) end - def test_to_hash - assert_equal({ - :foo => 1, - :bar => 2, - :baz => 3 - }, to_hash([[:foo, 1], [:bar, 2], [:baz, 3]])) - end - def test_powerset return unless Set[Set[]] == Set[Set[]] # There's a bug in Ruby 1.8.6 that breaks nested set equality assert_equal([[].to_set].to_set,