Class: BillyMays::CapitalizeWords
- Inherits:
-
Object
- Object
- BillyMays::CapitalizeWords
- Defined in:
- lib/sqlize.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#capitalized ⇒ Object
Returns the value of attribute capitalized.
-
#keywords ⇒ Object
readonly
Returns the value of attribute keywords.
-
#orig ⇒ Object
Returns the value of attribute orig.
Instance Method Summary collapse
- #capitalize ⇒ Object
-
#initialize(orig) ⇒ CapitalizeWords
constructor
A new instance of CapitalizeWords.
Constructor Details
#initialize(orig) ⇒ CapitalizeWords
Returns a new instance of CapitalizeWords.
20 21 22 |
# File 'lib/sqlize.rb', line 20 def initialize(orig) @orig = orig end |
Instance Attribute Details
#capitalized ⇒ Object
Returns the value of attribute capitalized.
19 20 21 |
# File 'lib/sqlize.rb', line 19 def capitalized @capitalized end |
#keywords ⇒ Object (readonly)
Returns the value of attribute keywords.
18 19 20 |
# File 'lib/sqlize.rb', line 18 def keywords @keywords end |
#orig ⇒ Object
Returns the value of attribute orig.
19 20 21 |
# File 'lib/sqlize.rb', line 19 def orig @orig end |
Instance Method Details
#capitalize ⇒ Object
24 25 26 27 |
# File 'lib/sqlize.rb', line 24 def capitalize regex = Regexp.new /\b#{Regexp.union @keywords.map{|w|Regexp.new(w, Regexp::IGNORECASE)}}\b/ @capitalized = @orig.gsub regex, &:upcase end |