Language#eql?

This commit is contained in:
Joshua Peek
2011-05-10 10:01:55 -05:00
parent 68718812bc
commit ef1ea9a0c9
2 changed files with 14 additions and 0 deletions

View File

@@ -58,6 +58,14 @@ module Linguist
def default_lexer?
lexer == default_lexer
end
def ==(other)
eql?(other)
end
def eql?(other)
equal?(other)
end
end
YAML.load_file(File.expand_path("../extensions.yml", __FILE__)).each do |name, options|

View File

@@ -55,4 +55,10 @@ class TestLanguage < Test::Unit::TestCase
assert Language['Python'].extensions.include?('.py')
assert Language['Ruby'].extensions.include?('.rb')
end
def test_eql
assert Language['Ruby'].eql?(Language['Ruby'])
assert !Language['Ruby'].eql?(Language['Python'])
assert !Language['Ruby'].eql?(Language.new(:name => 'Ruby'))
end
end