Sha256: 1cac43fd5c64d189ef1b96bb4218b18c454556000f238dad94a724c7d1c6abc2
Contents?: true
Size: 925 Bytes
Versions: 2
Compression:
Stored size: 925 Bytes
Contents
require "detect_language/version" require "detect_language/errors" require "detect_language/configuration" require "detect_language/client" module DetectLanguage class << self attr_writer :configuration def configure yield(configuration) end # The configuration object. # @see DetectLanguage.configure def configuration @configuration ||= Configuration.new end def client @client ||= Client.new(configuration) end def detect(data) key = data.is_a?(Array) ? 'q[]' : 'q' result = client.post(:detect, key => data) result['data']['detections'] end def simple_detect(text) detections = detect(text) if detections.empty? nil else detections[0]['language'] end end def user_status client.post('user/status') end def languages client.get('languages') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
detect_language-1.0.7 | lib/detect_language.rb |
detect_language-1.0.6 | lib/detect_language.rb |