Class: Tongues::Configuration
- Inherits:
-
Object
- Object
- Tongues::Configuration
- Includes:
- Singleton
- Defined in:
- lib/tongues/config/configuration.rb
Class Method Summary collapse
-
.api_key ⇒ Object
Returns the api key.
-
.api_key=(key) ⇒ Object
Modifies the api_key.
-
.api_url ⇒ Object
Returns the api url.
-
.languages ⇒ Object
Returns a hash of supported languages.
Instance Method Summary collapse
-
#api_key ⇒ Object
Returns the api key.
-
#api_key=(key) ⇒ Object
Modifies the api_key.
Class Method Details
.api_key ⇒ Object
Returns the api key
34 35 36 |
# File 'lib/tongues/config/configuration.rb', line 34 def self.api_key @@api_key ||= '' end |
.api_key=(key) ⇒ Object
Modifies the api_key
39 40 41 |
# File 'lib/tongues/config/configuration.rb', line 39 def self.api_key=(key) @@api_key = key end |
.api_url ⇒ Object
Returns the api url
19 20 21 |
# File 'lib/tongues/config/configuration.rb', line 19 def self.api_url 'http://ws.detectlanguage.com/0.2/detect' end |
.languages ⇒ Object
Returns a hash of supported languages
44 45 46 |
# File 'lib/tongues/config/configuration.rb', line 44 def self.languages YAML::load(File.open(File.dirname(__FILE__) + '/config.yml'))['correspondences'] end |
Instance Method Details
#api_key ⇒ Object
Returns the api key
24 25 26 |
# File 'lib/tongues/config/configuration.rb', line 24 def api_key @@api_key ||= '' end |
#api_key=(key) ⇒ Object
Modifies the api_key
29 30 31 |
# File 'lib/tongues/config/configuration.rb', line 29 def api_key=(key) @@api_key = key end |