Displaying 2 results from an estimated 2 matches for "string_extensions".
2006 Jul 18
8
Including files from lib/
I asked about this a few days ago and got no replies, so I''m asking again.
I have a file called string_extensions.rb. In it, I extend the String class
to include some extra functionality. I put this file into the lib/ directory
of my app.
But the changes made to String don''t take effect. The program acts as though
the files aren''t being included.
I''ve stopped and restarted the serv...
2008 Feb 03
4
Extract vowels and consonants using Ruby Regex
Hello,
I am trying to build a regex to extract vowels and consonants from a
string. So far, I am able to extract the basic a-e-i-o-u sequence
using the following extension to the String class:
class String
def vowels
scan(/[aeiou]/i)
end
def consonants
scan(/[^aeiou]/i)
end
end
examples:
>> "Mary had a little lamb".vowels
=> aaaiea
>> "Mary had a