Class: Hoygancop::Rules::TooMuchCaps
- Inherits:
-
Object
- Object
- Hoygancop::Rules::TooMuchCaps
- Defined in:
- lib/hoygancop/rules/too_much_caps.rb
Instance Method Summary collapse
- #correct ⇒ Object
- #hoygan? ⇒ Boolean
-
#initialize(text) ⇒ TooMuchCaps
constructor
A new instance of TooMuchCaps.
- #report ⇒ Object
Constructor Details
#initialize(text) ⇒ TooMuchCaps
6 7 8 |
# File 'lib/hoygancop/rules/too_much_caps.rb', line 6 def initialize(text) @text = text end |
Instance Method Details
#correct ⇒ Object
14 15 16 17 18 |
# File 'lib/hoygancop/rules/too_much_caps.rb', line 14 def correct text = capitalize(@text, '.') text = capitalize(text, '?') text = capitalize(text, '!') end |
#hoygan? ⇒ Boolean
10 11 12 |
# File 'lib/hoygancop/rules/too_much_caps.rb', line 10 def hoygan? @text.scan(/[A-Z]/).length > @text.length/2 end |
#report ⇒ Object
20 21 22 |
# File 'lib/hoygancop/rules/too_much_caps.rb', line 20 def report hoygan? ? [:too_much_caps] : [] end |