class Oolite::SystemsData

Public Class Methods

add(sys_data) click to toggle source
# File lib/oolite/systems_data.rb, line 21
def self.add sys_data
  systems[sys_data.name] = sys_data
  write_config
end
names() click to toggle source
# File lib/oolite/systems_data.rb, line 17
def self.names
  systems.keys
end
systems() click to toggle source
# File lib/oolite/systems_data.rb, line 13
def self.systems
  @systems ||= read_config
end

Private Class Methods

read_config() click to toggle source
# File lib/oolite/systems_data.rb, line 28
def self.read_config
  data = Oolite.configuration.systems
  sys_objs = Hash.new

  data.each do |name, sys_data|
    sys_objs[name] = SystemData.new name, sys_data
  end

  sys_objs
end
write_config() click to toggle source
# File lib/oolite/systems_data.rb, line 39
def self.write_config
  Oolite.configure do |config|
    systems.each do |name, sys|
      config.systems[name] = sys.to_yaml
    end
  end

  Oolite.save_configuration
end