dynahash 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
|