class YanSpeller::Speller
Attributes
status[R]
Public Class Methods
new()
click to toggle source
# File lib/yan_speller/speller.rb, line 9 def initialize @spell_request = SpellRequest.new @errors = [] @status = :request_fail end
Public Instance Methods
check_spell(text)
click to toggle source
# File lib/yan_speller/speller.rb, line 15 def check_spell text result = @spell_request.send text if @spell_request.success? @errors = JSON.parse(result.body).map do |err| SpellError.new err end @status = @errors.empty? ? :no_spell_errors : :spell_errors else @status = :request_fail end end
errors_to_s()
click to toggle source
# File lib/yan_speller/speller.rb, line 27 def errors_to_s @errors.map { |err| err.to_s } end