Class: Billy::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/billy/config.rb

Constant Summary collapse

DEFAULT_WHITELIST =
['127.0.0.1', 'localhost']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



12
13
14
15
# File 'lib/billy/config.rb', line 12

def initialize
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
  reset
end

Instance Attribute Details

#cacheObject

Returns the value of attribute cache.



8
9
10
# File 'lib/billy/config.rb', line 8

def cache
  @cache
end

#cache_pathObject

Returns the value of attribute cache_path.



8
9
10
# File 'lib/billy/config.rb', line 8

def cache_path
  @cache_path
end

#cache_request_headersObject

Returns the value of attribute cache_request_headers.



8
9
10
# File 'lib/billy/config.rb', line 8

def cache_request_headers
  @cache_request_headers
end

#ignore_cache_portObject

Returns the value of attribute ignore_cache_port.



8
9
10
# File 'lib/billy/config.rb', line 8

def ignore_cache_port
  @ignore_cache_port
end

#ignore_paramsObject

Returns the value of attribute ignore_params.



8
9
10
# File 'lib/billy/config.rb', line 8

def ignore_params
  @ignore_params
end

#loggerObject

Returns the value of attribute logger.



8
9
10
# File 'lib/billy/config.rb', line 8

def logger
  @logger
end

#non_successful_cache_disabledObject

Returns the value of attribute non_successful_cache_disabled.



8
9
10
# File 'lib/billy/config.rb', line 8

def non_successful_cache_disabled
  @non_successful_cache_disabled
end

#non_successful_error_levelObject

Returns the value of attribute non_successful_error_level.



8
9
10
# File 'lib/billy/config.rb', line 8

def non_successful_error_level
  @non_successful_error_level
end

#non_whitelisted_requests_disabledObject

Returns the value of attribute non_whitelisted_requests_disabled.



8
9
10
# File 'lib/billy/config.rb', line 8

def non_whitelisted_requests_disabled
  @non_whitelisted_requests_disabled
end

#path_blacklistObject

Returns the value of attribute path_blacklist.



8
9
10
# File 'lib/billy/config.rb', line 8

def path_blacklist
  @path_blacklist
end

#persist_cacheObject

Returns the value of attribute persist_cache.



8
9
10
# File 'lib/billy/config.rb', line 8

def persist_cache
  @persist_cache
end

#whitelistObject

Returns the value of attribute whitelist.



8
9
10
# File 'lib/billy/config.rb', line 8

def whitelist
  @whitelist
end

Instance Method Details

#resetObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/billy/config.rb', line 17

def reset
  @cache = true
  @cache_request_headers = false
  @whitelist = DEFAULT_WHITELIST
  @path_blacklist = []
  @ignore_params = []
  @persist_cache = false
  @ignore_cache_port = true
  @non_successful_cache_disabled = false
  @non_successful_error_level = :warn
  @non_whitelisted_requests_disabled = false
  @cache_path = File.join(Dir.tmpdir, 'puffing-billy')
end