Class: SiteClassifier::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/site_classifier/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Configuration

Instantiate a new class



6
7
8
9
10
# File 'lib/site_classifier/configuration.rb', line 6

def initialize(options = {})
  @translate = options[:translate] || false
  @google_translate_api_key = options[:google_translate_api_key]
  @debug = options[:debug] || false
end

Instance Attribute Details

#debugObject

Returns the value of attribute debug.



3
4
5
# File 'lib/site_classifier/configuration.rb', line 3

def debug
  @debug
end

#google_translate_api_keyObject

Returns the value of attribute google_translate_api_key.



3
4
5
# File 'lib/site_classifier/configuration.rb', line 3

def google_translate_api_key
  @google_translate_api_key
end

#translateObject

Returns the value of attribute translate.



3
4
5
# File 'lib/site_classifier/configuration.rb', line 3

def translate
  @translate
end

Class Method Details

.configure {|new_configuration| ... } ⇒ Object

Configure by block

Yields:

  • (new_configuration)


17
18
19
20
21
# File 'lib/site_classifier/configuration.rb', line 17

def self.configure(&block)
  new_configuration = SiteClassifier::Configuration.new
  yield new_configuration
  new_configuration
end

Instance Method Details

#debug?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/site_classifier/configuration.rb', line 12

def debug?
  self.debug == true
end