Module: Configs
- Defined in:
- lib/configs.rb
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
14 15 16 17 18 |
# File 'lib/configs.rb', line 14 def self.attributes class_variables.map do |var| var.to_s.scan(/@@(.*)/).first.first.to_sym end end |
.clear ⇒ Object
24 25 26 27 28 |
# File 'lib/configs.rb', line 24 def self.clear class_variables.each do |var| class_variable_set(var, nil) end end |
.method_missing(method_name, *args) ⇒ Object
20 21 22 |
# File 'lib/configs.rb', line 20 def self.method_missing(method_name, *args) nil end |
.set(sym_or_hash, value = nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/configs.rb', line 3 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 |