Sha256: 5d7caefa3f314498e91049df1ce1dc1fcd15f77f3ced4440ab15f7da186d687a
Contents?: true
Size: 973 Bytes
Versions: 8
Compression:
Stored size: 973 Bytes
Contents
module Wovnrb class Settings < Hash def initialize(*args, **kwargs) super(*args, **kwargs) @dynamic_settings = {} end def [](key) return @dynamic_settings[key] if @dynamic_settings.key?(key) return ignore_globs if key == 'ignore_globs' super(key) end def ignore_globs ignore_paths = self['ignore_paths'] return [] unless ignore_paths.is_a?(Array) ignore_paths.map { |pattern| Glob.new(pattern) } end def clear_dynamic_settings! @dynamic_settings.clear end def update_dynamic_settings!(params) # If the user defines dynamic settings for this request, use it instead of the config DYNAMIC_KEYS.each do |params_key, setting_key| value = params[params_key] @dynamic_settings[setting_key] = value if value end end DYNAMIC_KEYS = { 'wovn_token' => 'project_token', 'wovn_ignore_paths' => 'ignore_paths' }.freeze end end
Version data entries
8 entries across 8 versions & 1 rubygems