Class: Merimee::Config
- Inherits:
-
Object
- Object
- Merimee::Config
- Defined in:
- lib/merimee/config.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
This is required by the service for caching purposes, but no registration is needed (api_key should just be unique for your app, only one request can happen per key at any moment).
-
#dictionary ⇒ Object
readonly
Returns the value of attribute dictionary.
-
#ignore_types ⇒ Object
Returns the value of attribute ignore_types.
-
#language ⇒ Object
The language to use for this check This is used to select the proper AtD server, unless overriden with the :language option.
Instance Method Summary collapse
- #dict_add(word) ⇒ Object
- #dict_add_file(file) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
21 22 23 24 25 26 |
# File 'lib/merimee/config.rb', line 21 def initialize @dictionary = [] @ignore_types = Merimee::DEFAULT_IGNORE_TYPES @api_key = Config.generate_api_key @language = Merimee::DEFAULT_LANGUAGE end |
Instance Attribute Details
#api_key ⇒ Object
This is required by the service for caching purposes, but no registration is needed (api_key should just be unique for your app, only one request can happen per key at any moment). There shouldn’t be any need for this, but still
15 16 17 |
# File 'lib/merimee/config.rb', line 15 def api_key @api_key end |
#dictionary ⇒ Object (readonly)
Returns the value of attribute dictionary.
8 9 10 |
# File 'lib/merimee/config.rb', line 8 def dictionary @dictionary end |
#ignore_types ⇒ Object
Returns the value of attribute ignore_types.
9 10 11 |
# File 'lib/merimee/config.rb', line 9 def ignore_types @ignore_types end |
#language ⇒ Object
The language to use for this check This is used to select the proper AtD server, unless overriden with the :language option
19 20 21 |
# File 'lib/merimee/config.rb', line 19 def language @language end |
Instance Method Details
#dict_add(word) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/merimee/config.rb', line 28 def dict_add(word) if word.kind_of?(String) @dictionary << word elsif word.kind_of?(Enumerable) @dictionary.concat word end end |
#dict_add_file(file) ⇒ Object
36 37 38 |
# File 'lib/merimee/config.rb', line 36 def dict_add_file(file) File.open(file) {|f| dict_add(f.readlines.map(&:strip)) } end |