mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Remove now-unused has? helper.
This commit is contained in:
parent
e1a77a9e91
commit
f3d53e0770
2 changed files with 0 additions and 23 deletions
|
@ -172,24 +172,6 @@ MSG
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Checks to see if a class has a given method.
|
|
||||||
# For example:
|
|
||||||
#
|
|
||||||
# Haml::Util.has?(:public_instance_method, String, :gsub) #=> true
|
|
||||||
#
|
|
||||||
# Method collections like `Class#instance_methods`
|
|
||||||
# return strings in Ruby 1.8 and symbols in Ruby 1.9 and on,
|
|
||||||
# so this handles checking for them in a compatible way.
|
|
||||||
#
|
|
||||||
# @param attr [#to_s] The (singular) name of the method-collection method
|
|
||||||
# (e.g. `:instance_methods`, `:private_methods`)
|
|
||||||
# @param klass [Module] The class to check the methods of which to check
|
|
||||||
# @param method [String, Symbol] The name of the method do check for
|
|
||||||
# @return [Boolean] Whether or not the given collection has the given method
|
|
||||||
def has?(attr, klass, method)
|
|
||||||
klass.send("#{attr}s").detect {|x| x.to_s == method.to_s}
|
|
||||||
end
|
|
||||||
|
|
||||||
# Like `Object#inspect`, but preserves non-ASCII characters rather than escaping them under Ruby 1.9.2.
|
# Like `Object#inspect`, but preserves non-ASCII characters rather than escaping them under Ruby 1.9.2.
|
||||||
# This is necessary so that the precompiled Haml template can be `#encode`d into `@options[:encoding]`
|
# This is necessary so that the precompiled Haml template can be `#encode`d into `@options[:encoding]`
|
||||||
# before being evaluated.
|
# before being evaluated.
|
||||||
|
|
|
@ -43,11 +43,6 @@ class UtilTest < MiniTest::Unit::TestCase
|
||||||
$stderr = old_stderr
|
$stderr = old_stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_has
|
|
||||||
assert(has?(:instance_method, String, :chomp!))
|
|
||||||
assert(has?(:private_instance_method, Haml::Engine, :set_locals))
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_caller_info
|
def test_caller_info
|
||||||
assert_equal(["/tmp/foo.rb", 12, "fizzle"], caller_info("/tmp/foo.rb:12: in `fizzle'"))
|
assert_equal(["/tmp/foo.rb", 12, "fizzle"], caller_info("/tmp/foo.rb:12: in `fizzle'"))
|
||||||
assert_equal(["/tmp/foo.rb", 12, nil], caller_info("/tmp/foo.rb:12"))
|
assert_equal(["/tmp/foo.rb", 12, nil], caller_info("/tmp/foo.rb:12"))
|
||||||
|
|
Loading…
Add table
Reference in a new issue