Class: ConfigLoader
- Inherits:
-
Object
- Object
- ConfigLoader
- Defined in:
- lib/config_loader.rb
Constant Summary collapse
- CONFIG_FILE =
File.('~/.load_shedding_config')
Class Method Summary collapse
-
.load_group ⇒ Object
Loads the group data.
-
.set_group ⇒ Object
sets the group data after asking form user.
Instance Method Summary collapse
-
#find_group ⇒ Object
loads the group information form the file.
Class Method Details
.load_group ⇒ Object
Loads the group data
5 6 7 8 9 10 11 |
# File 'lib/config_loader.rb', line 5 def load_group klass = File.exists?(CONFIG_FILE) ? self : Interfacer obj = klass.new group = obj.find_group obj.persist(group, CONFIG_FILE) if obj.respond_to?(:persist) group end |
.set_group ⇒ Object
sets the group data after asking form user
14 15 16 17 18 |
# File 'lib/config_loader.rb', line 14 def set_group obj = Interfacer.new group = obj.find_group obj.persist(group,CONFIG_FILE) end |
Instance Method Details
#find_group ⇒ Object
loads the group information form the file
22 23 24 |
# File 'lib/config_loader.rb', line 22 def find_group File.read(CONFIG_FILE) end |