Module: Monkeylearn::Configurable

Included in:
Monkeylearn
Defined in:
lib/monkeylearn/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auto_batchObject

Returns the value of attribute auto_batch.



5
6
7
# File 'lib/monkeylearn/configurable.rb', line 5

def auto_batch
  @auto_batch
end

#base_urlObject

Returns the value of attribute base_url.



5
6
7
# File 'lib/monkeylearn/configurable.rb', line 5

def base_url
  @base_url
end

#retry_if_throttleObject

Returns the value of attribute retry_if_throttle.



5
6
7
# File 'lib/monkeylearn/configurable.rb', line 5

def retry_if_throttle
  @retry_if_throttle
end

#tokenObject

Returns the value of attribute token.



5
6
7
# File 'lib/monkeylearn/configurable.rb', line 5

def token
  @token
end

Class Method Details

.keysObject



9
10
11
12
13
14
15
16
# File 'lib/monkeylearn/configurable.rb', line 9

def keys
  @keys ||= [
    :base_url,
    :token,
    :retry_if_throttle,
    :auto_batch,
  ]
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



19
20
21
# File 'lib/monkeylearn/configurable.rb', line 19

def configure
  yield self
end

#reset!Object



23
24
25
26
27
28
# File 'lib/monkeylearn/configurable.rb', line 23

def reset!
  Monkeylearn::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", Monkeylearn::Defaults.options[key])
  end
  self
end