Skip to content
Browse files

Adding support for upper case letters. Fixes #2

  • Loading branch information...
1 parent 3d612fa commit 220ac4442a34a80b276ef2d5439c57055315e06e @steveklabnik committed Feb 27, 2011
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/derp.rb
  2. +4 −0 test/derp_test.rb
View
2 lib/derp.rb
@@ -31,7 +31,7 @@ class String
def to_derp
out = ""
- self.split(//).each do |c|
+ self.downcase.split(//).each do |c|
out += Morse[c] + " " unless Morse[c].nil?
end
out.rstrip
View
4 test/derp_test.rb
@@ -51,4 +51,8 @@ def test_from_long_words
def test_from_different_characters
assert_equal "herpderp derpherpherpherp".from_derp, "ab"
end
+
+ def test_to_capital_letters
+ assert_equal "AA".to_derp, "herpderp herpderp"
+ end
end

0 comments on commit 220ac44

Please sign in to comment.
Something went wrong with that request. Please try again.