Class: Merimee::Checker
- Inherits:
-
Object
- Object
- Merimee::Checker
- Defined in:
- lib/merimee/checker.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #check(text, options = {}) ⇒ Object
-
#initialize(config = nil) {|@config| ... } ⇒ Checker
constructor
A new instance of Checker.
Constructor Details
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/merimee/checker.rb', line 5 def config @config end |
Instance Method Details
#check(text, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/merimee/checker.rb', line 11 def check(text, = {}) AfterTheDeadline.language = [:language] || @config.language AfterTheDeadline.key = @config.api_key errors = AfterTheDeadline.check(text) # Remove spelling errors from our custom dictionary # Also remove stuff that is obviously not a word (AtD seems to have issues sometime) errors.reject! do |e| e.type == 'spelling' && @config.dictionary.include?(e.string) end # Remove any error types we don't care about errors.each do |err| err.severity = @config.severity[err.description.downcase] || :error end errors end |