Module: Hoygancop
- Defined in:
- lib/hoygancop.rb,
lib/hoygancop/support.rb,
lib/hoygancop/version.rb,
lib/hoygancop/rules/ayudenme.rb,
lib/hoygancop/rules/simple_rule.rb,
lib/hoygancop/rules/too_much_caps.rb,
lib/hoygancop/rules/too_much_marks.rb,
lib/hoygancop/rules/starts_with_hoygan.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.0.1.2"
Class Method Summary collapse
- .correct(text, options = {}) ⇒ Object
- .default_rules ⇒ Object
- .hoygan?(text, options = {}) ⇒ Boolean
- .report(text, options = {}) ⇒ Object
- .ruleset(rules) ⇒ Object
Class Method Details
.correct(text, options = {}) ⇒ Object
21 22 23 24 |
# File 'lib/hoygancop.rb', line 21 def self.correct(text, = {}) rules = ([:rules] || default_rules) ruleset(rules).inject(text){ |text, rule| rule.new(text).correct } end |
.default_rules ⇒ Object
6 7 8 |
# File 'lib/hoygancop.rb', line 6 def self.default_rules %w{starts_with_hoygan ayudenme too_much_marks too_much_caps} end |
.hoygan?(text, options = {}) ⇒ Boolean
16 17 18 19 |
# File 'lib/hoygancop.rb', line 16 def self.hoygan?(text, = {}) rules = ([:rules] || default_rules) ruleset(rules).any?{ |rule| rule.new(text).hoygan? } end |
.report(text, options = {}) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/hoygancop.rb', line 26 def self.report(text, = {}) rules = ([:rules] || default_rules) ruleset(rules).inject(Set.new) do |report, rule| report + rule.new(text).report end.to_a end |