dynahash 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dynahash.rb +1 -1
- data/test/test.rb +4 -0
- metadata +1 -1
data/lib/dynahash.rb
CHANGED
@@ -24,7 +24,7 @@ class Hash
|
|
24
24
|
# caller handle it.
|
25
25
|
name = m.to_s
|
26
26
|
self.keys.find(name) { |key|
|
27
|
-
key.to_s.gsub(/(
|
27
|
+
key.to_s.gsub(/(@+|:+|\-+|\*+|\.+|\?+)/, ' ').gsub(/(?<before>[a-z])(?<after>[A-Z])/, '\k<before>_\k<after>').scan(/\w+/).join('_').casecmp(name.gsub(/\?+/, '')) == 0
|
28
28
|
}
|
29
29
|
end
|
30
30
|
end
|
data/test/test.rb
CHANGED
@@ -61,6 +61,10 @@ class TestDynaHash < Test::Unit::TestCase
|
|
61
61
|
assert_equal('A million bucks', h.something_great)
|
62
62
|
end
|
63
63
|
|
64
|
+
def test_ignore_question_mark_on_end
|
65
|
+
h = {'Display' => true}
|
66
|
+
assert_equal(true, h.display?)
|
67
|
+
end
|
64
68
|
def test_all_removals_and_replacements_together
|
65
69
|
h = {'@name' => 'Tony', 'Person Gender' => :male, :dude_type => 'coolness', '-w:T@@F--' => 'um, ok' }
|
66
70
|
|