module Monkeylearn::Defaults

Constants

AUTO_BATCH
BASE_URL

Configurable options

DEFAULT_BATCH_SIZE

Constants

MAX_BATCH_SIZE
RETRY_IF_THROTTLE

Public Class Methods

auto_batch() click to toggle source
# File lib/monkeylearn/defaults.rb, line 28
def auto_batch
  boolean_setting('MONKEYLEARN_AUTO_BATCH', AUTO_BATCH)
end
base_url() click to toggle source
# File lib/monkeylearn/defaults.rb, line 16
def base_url
  ENV['MONKEYLEARN_API_BASE_URL'] || BASE_URL
end
default_batch_size() click to toggle source
# File lib/monkeylearn/defaults.rb, line 36
def default_batch_size
  DEFAULT_BATCH_SIZE
end
max_batch_size() click to toggle source
# File lib/monkeylearn/defaults.rb, line 32
def max_batch_size
  MAX_BATCH_SIZE
end
options() click to toggle source
# File lib/monkeylearn/defaults.rb, line 12
def options
  Hash[Monkeylearn::Configurable.keys.map{|key| [key, send(key)]}]
end
retry_if_throttle() click to toggle source
# File lib/monkeylearn/defaults.rb, line 24
def retry_if_throttle
  boolean_setting('MONKEYLEARN_RETRY_IF_THROTTLE', RETRY_IF_THROTTLE)
end
token() click to toggle source
# File lib/monkeylearn/defaults.rb, line 20
def token
  ENV['MONKEYLEARN_TOKEN'] || nil
end

Private Class Methods

boolean_setting(key, default) click to toggle source
# File lib/monkeylearn/defaults.rb, line 42
def boolean_setting(key, default)
  return default unless ENV.key?(key)
  return !['nil', '', '0', 'off', 'false', 'f'].include?(ENV[key].to_s.downcase)
end