class Digup::Setting
Constants
- BOOLEAN_SETTINGS
- DEFAULT_SETTINGS
- LOG_TO
- RESPONSE_TYPE
Attributes
options[RW]
Public Class Methods
content_type_to_handle()
click to toggle source
# File lib/digup/setting.rb, line 52 def content_type_to_handle content_type = [] content_type << 'text/html' if handle_html? content_type << 'text/javascript' if handle_js? content_type << 'application/json' if handle_json? content_type end
enabled?()
click to toggle source
# File lib/digup/setting.rb, line 29 def enabled? @options.present? end
option_to_array(options, key)
click to toggle source
# File lib/digup/setting.rb, line 44 def option_to_array(options, key) if options[key].is_a? Array options[key] else [options[key]] end & DEFAULT_SETTINGS[key] end
options=(options)
click to toggle source
# File lib/digup/setting.rb, line 33 def options=(options) if options.is_a? Hash options.slice!(:response_type, :log_to, :cursor_info) options[:response_type] = option_to_array(options, :response_type) options[:log_to] = option_to_array(options, :log_to) @options = DEFAULT_SETTINGS.merge(options) elsif options == :default @options = DEFAULT_SETTINGS end end