class EacLauncher::Context::Settings
Public Class Methods
new(file)
click to toggle source
# File lib/eac_launcher/context/settings.rb, line 12 def initialize(file) unless ::File.exist?(file) ::FileUtils.mkdir_p(::File.dirname(file)) ::File.write(file, {}.to_yaml) end @data = YAML.load_file(file) end
Public Instance Methods
instance_settings(instance)
click to toggle source
# File lib/eac_launcher/context/settings.rb, line 20 def instance_settings(instance) ::EacLauncher::Instances::Settings.new(value(['Instances', instance.name])) end
Private Instance Methods
enum_value(path)
click to toggle source
# File lib/eac_launcher/context/settings.rb, line 34 def enum_value(path) r = value(path) r.is_a?(Enumerable) ? r : [] end
excluded_paths_uncached()
click to toggle source
# File lib/eac_launcher/context/settings.rb, line 30 def excluded_paths_uncached enum_value(%w[Paths Exclude]) end
excluded_projects_uncached()
click to toggle source
# File lib/eac_launcher/context/settings.rb, line 26 def excluded_projects_uncached enum_value(%w[Projects Exclude]) end
node_value(data, path)
click to toggle source
# File lib/eac_launcher/context/settings.rb, line 43 def node_value(data, path) return data if path.empty? return nil unless data.is_a?(Hash) node_value(data[path.first], path.drop(1)) end
value(path)
click to toggle source
# File lib/eac_launcher/context/settings.rb, line 39 def value(path) node_value(@data, path) end