Sha256: 49623ab70288927100e637d5240fa9a95757c4a94097104c10a0f7a0619f4c31
Contents?: true
Size: 717 Bytes
Versions: 5
Compression:
Stored size: 717 Bytes
Contents
require 'singleton' module Judge class Config include Singleton @@exposed = {} def expose(klass, *attributes) attrs = (@@exposed[klass] ||= []) attrs.concat(attributes).uniq! end def exposed @@exposed end def exposed?(klass, attribute) @@exposed.has_key?(klass) && @@exposed[klass].include?(attribute) end def unexpose(klass, *attributes) attributes.each do |a| @@exposed[klass].delete(a) end if attributes.empty? || @@exposed[klass].empty? @@exposed.delete(klass) end end end def self.config Config.instance end def self.configure(&block) Config.instance.instance_eval(&block) end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
judge-2.0.4 | lib/judge/config.rb |
judge-2.0.3 | lib/judge/config.rb |
judge-2.0.2 | lib/judge/config.rb |
judge-2.0.1 | lib/judge/config.rb |
judge-2.0.0 | lib/judge/config.rb |