Sha256: 7c0c04caaeeb721d72641944bb9a4393243cc3073c5bd18d092ed3a2f2bdf2ee
Contents?: true
Size: 1.13 KB
Versions: 5
Compression:
Stored size: 1.13 KB
Contents
## # ConfigHelper # module ConfigHelper def self.included(base) base.extend ClassMethods end #------------------ def config(options) @_config_reset = NPR.config NPR.config.merge(options) end #------------------ def reset_config NPR.instance_variable_set(:@config, @_config_reset) end #------------------ def config!(options) config = NPR::Configuration.new(options) NPR.instance_variable_set(:@config, config) end #------------------ def clear_config NPR.instance_variable_set(:@config, nil) end #------------------ module ClassMethods # Merge the options into whatever the config # currently is, and reset it to its previous # state after. def config(options) before :all do config(options) end after :all do reset_config end end #-------------------- # Set the config to ONLY the provided options, # and set to nil after. def config!(options) before :all do config!(options) end after :all do reset_config end end end end
Version data entries
5 entries across 5 versions & 1 rubygems