class Troo::Configuration

Public Class Methods

load(file, env) click to toggle source

@param [String] @param [String] @return [Troo::Configuration]

# File lib/troo/configuration.rb, line 19
def load(file, env)
  new(YAML.load_file(file)[env])
end

Public Instance Methods

save(file, env) click to toggle source

@param [String] @param [String] @return [TrueClass, FalseClass]

# File lib/troo/configuration.rb, line 27
def save(file, env)
  return true if File.open(file, 'w') do |file|
    file.write configuration_yaml(env)
  end
  false
end
view() click to toggle source

@return [String]

# File lib/troo/configuration.rb, line 35
def view
  attributes.map do |label, value|
    Preference.view(label: label, value: value)
  end.join("\n")
end

Private Instance Methods

configuration_yaml(env = 'default') click to toggle source
# File lib/troo/configuration.rb, line 43
def configuration_yaml(env = 'default')
  { env => self.attributes }.to_yaml
end