Module: Configs
- Defined in:
- lib/configs.rb
Overview
Systemwide Singleton, which can be used to store global configurations, like paths or some other settings
Class Method Summary collapse
- .attributes ⇒ Object
- .clear ⇒ Object
- .method_missing(method_name, *args) ⇒ Object
- .set(sym_or_hash, value = nil) ⇒ Object
Class Method Details
.attributes ⇒ Object
42 43 44 45 46 |
# File 'lib/configs.rb', line 42 def self.attributes class_variables.map do |var| var.to_s.scan(/@@(.*)/).first.first.to_sym end end |
.clear ⇒ Object
52 53 54 55 56 |
# File 'lib/configs.rb', line 52 def self.clear class_variables.each do |var| class_variable_set(var, nil) end end |
.method_missing(method_name, *args) ⇒ Object
48 49 50 |
# File 'lib/configs.rb', line 48 def self.method_missing(method_name, *args) nil end |
.set(sym_or_hash, value = nil) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/configs.rb', line 31 def self.set(sym_or_hash, value = nil) unless sym_or_hash.is_a? Hash sym_or_hash = { sym_or_hash => value } end sym_or_hash.each_pair do |attr, value| set_attribute(attr, value) end end |