Getting rid of unecessary modification to core String and NilClass classes. Thanks to Ingo Weiss for pointing this out.
git-svn-id: svn://hamptoncatlin.com/haml/trunk@608 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
parent
04cbfecc88
commit
015f0cff61
|
@ -152,7 +152,7 @@ module Haml
|
|||
" #{a}=#{attr_wrapper}#{v}#{attr_wrapper}"
|
||||
end
|
||||
end
|
||||
result.sort.join
|
||||
result.compact.sort.join
|
||||
end
|
||||
|
||||
# Returns whether or not the given value is short enough to be rendered
|
||||
|
@ -195,26 +195,3 @@ module Haml
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
unless String.methods.include? 'old_comp'
|
||||
class String # :nodoc
|
||||
alias_method :old_comp, :<=>
|
||||
|
||||
def <=>(other)
|
||||
if other.is_a? NilClass
|
||||
-1
|
||||
else
|
||||
old_comp(other)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class NilClass # :nodoc:
|
||||
include Comparable
|
||||
|
||||
def <=>(other)
|
||||
other.nil? ? 0 : 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -155,11 +155,6 @@ class EngineTest < Test::Unit::TestCase
|
|||
assert_equal("<p a='b2c'>\n</p>\n", render('%p{:a => "b#{1 + 1}c"}'))
|
||||
assert_equal("<p a='b2c'>\n</p>\n", render("%p{:a => 'b' + (1 + 1).to_s + 'c'}"))
|
||||
end
|
||||
|
||||
def test_comps
|
||||
assert_equal(-1, "foo" <=> nil)
|
||||
assert_equal(1, nil <=> "foo")
|
||||
end
|
||||
|
||||
def test_rec_merge
|
||||
hash1 = {1=>2, 3=>{5=>7, 8=>9}}
|
||||
|
|
Loading…
Reference in New Issue