Module: Linguo
- Defined in:
- lib/linguo.rb,
lib/linguo/config.rb,
lib/linguo/detect.rb,
lib/linguo/errors.rb,
lib/linguo/version.rb,
lib/rails/generators/linguo/config_generator.rb
Defined Under Namespace
Modules: Config, Errors Classes: ConfigGenerator, Detect
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
-
.api_key=(val) ⇒ Object
Sets API key obtained from detectlanguage.com.
-
.detect(text, api_key = nil) ⇒ Linguo::Detect
Creates a new instance of Linguo::Detect.
Class Method Details
.api_key=(val) ⇒ Object
Sets API key obtained from detectlanguage.com.
13 14 15 |
# File 'lib/linguo.rb', line 13 def self.api_key=(val) Config.api_key = val end |
.detect(text, api_key = nil) ⇒ Linguo::Detect
Creates a new instance of Linguo::Detect.
Note that api_key is optional and isn’t required once you set Linguo::Config.api_key
or ENV['LINGUO_API_KEY']
.
25 26 27 28 |
# File 'lib/linguo.rb', line 25 def self.detect(text, api_key=nil) api_key = api_key || Linguo::Config.api_key || ENV['LINGUO_API_KEY'] Detect.new(text, api_key) end |