Module: KungFigure::ClassMethods
- Defined in:
- lib/kung_figure.rb
Instance Method Summary collapse
- #clear_config ⇒ Object
- #clear_config! ⇒ Object
- #config ⇒ Object
- #configure(&block) ⇒ Object
- #load_config(path) ⇒ Object
- #root_config_class ⇒ Object
- #set_root_config_class(klazz) ⇒ Object
Instance Method Details
#clear_config ⇒ Object
48 49 50 |
# File 'lib/kung_figure.rb', line 48 def clear_config @config = root_config_class.new end |
#clear_config! ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/kung_figure.rb', line 52 def clear_config! KungFigure::Register.each do |klz| #clear only branch for this module reg = /^#{self.name}/ if klz.name.to_s =~ reg klz.clear_config end end end |
#config ⇒ Object
44 45 46 |
# File 'lib/kung_figure.rb', line 44 def config @config ||= root_config_class.new end |
#configure(&block) ⇒ Object
62 63 64 |
# File 'lib/kung_figure.rb', line 62 def configure(&block) config.instance_eval &block end |
#load_config(path) ⇒ Object
66 67 68 |
# File 'lib/kung_figure.rb', line 66 def load_config(path) load path end |
#root_config_class ⇒ Object
40 41 42 |
# File 'lib/kung_figure.rb', line 40 def root_config_class self.const_get(@root_config_class || :Config) end |
#set_root_config_class(klazz) ⇒ Object
36 37 38 |
# File 'lib/kung_figure.rb', line 36 def set_root_config_class(klazz) @root_config_class = klazz end |