Sha256: 1f96c89389ca22babaef3b7cfb4e43dc468b34bde769883dc9abd0257e25ea5a
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
module SimpleHelpers class Config VALID_OPTIONS = [:log] def self.whitelist @whitelist ||= [] end def self.whitelist=(*allowed) @whitelist = SimpleHelpers::Support.certified_array!(allowed) end def self.blacklist @blacklist ||= [] end def self.blacklist=(*not_allowed) @blacklist = SimpleHelpers::Support.certified_array!(not_allowed) end def self.helpers @helpers ||= [] end def self.helpers=(*helper_methods) @helpers = SimpleHelpers::Support.certified_array!(helper_methods) end def self.allowed_controller?(controller) ( @whitelist.empty? and @blacklist.empty? ) or ( not @whitelist.empty? and @whitelist.include?(controller) ) or ( not @blacklist.empty? and not @blacklist.include?(controller) ) end def self.options @options ||= [] end def self.options=(*args) options_list = SimpleHelpers::Support.certified_array!(args) @options = options_list.collect{|c| c.to_sym } end def self.has_option?(option) @options.include?(option.to_sym) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
simple_helpers-0.0.3 | lib/simple_helpers/config.rb |
simple_helpers-0.0.2 | lib/simple_helpers/config.rb |
simple_helpers-0.0.1 | lib/simple_helpers/config.rb |