Class: Hoygancop::Rules::TooMuchCaps

Inherits:
Object
  • Object
show all
Defined in:
lib/hoygancop/rules/too_much_caps.rb

Instance Method Summary collapse

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

#correctObject



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

#reportObject



20
21
22
# File 'lib/hoygancop/rules/too_much_caps.rb', line 20

def report
  hoygan? ? [:too_much_caps] : []
end