Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/highscore/string.rb
Overview
monkey patch to call custom methods on arbitrary strings
Instance Method Summary collapse
-
#consonants ⇒ Object
get all consonants from a string.
-
#keywords(wordlist = nil, &block) ⇒ Object
get keywords from the string.
-
#vowels ⇒ Object
get all vowels from a string.
Instance Method Details
#consonants ⇒ Object
get all consonants from a string
34 35 36 |
# File 'lib/highscore/string.rb', line 34 def consonants gsub(/[aeiou]/, '') end |
#keywords(wordlist = nil, &block) ⇒ Object
get keywords from the string
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/highscore/string.rb', line 12 def keywords(wordlist = nil, &block) content = Highscore::Content.new(self, wordlist) if block_given? content.configure do content.instance_eval(&block) end end content.keywords end |
#vowels ⇒ Object
get all vowels from a string
27 28 29 |
# File 'lib/highscore/string.rb', line 27 def vowels gsub(/[^aeiou]/, '') end |