module Settings

Public Instance Methods

bindings() click to toggle source
# File lib/titanfall/settings.rb, line 3
def bindings
  bindings_hash
end
settings() click to toggle source
# File lib/titanfall/settings.rb, line 7
def settings
  settings_hash
end

Private Instance Methods

bind_rows() click to toggle source
# File lib/titanfall/settings.rb, line 29
def bind_rows
  settings_collection.select { |row| row.start_with?('bind') }
end
bindings_hash() click to toggle source
# File lib/titanfall/settings.rb, line 13
def bindings_hash
  bind_rows.map { |x| x[5..-1] }.inject({}) do |hash, item|
    key, value = item.split(' ', 2)
    hash[key.tr!('"', '')] = value.tr!('"', '')
    hash
  end
end
other_settings_rows() click to toggle source
# File lib/titanfall/settings.rb, line 33
def other_settings_rows
  settings_collection.select { |row| !row.start_with?('bind') }
end
settings_cfg_file() click to toggle source
# File lib/titanfall/settings.rb, line 41
def settings_cfg_file
  File.open(settings_cfg_file_path, 'r').read
end
settings_cfg_file_path() click to toggle source
# File lib/titanfall/settings.rb, line 45
def settings_cfg_file_path
  "#{path}\\Titanfall\\local\\settings.cfg"
end
settings_collection() click to toggle source
# File lib/titanfall/settings.rb, line 37
def settings_collection
  settings_cfg_file.split("\n")
end
settings_hash() click to toggle source
# File lib/titanfall/settings.rb, line 21
def settings_hash
  other_settings_rows.inject({}) do |hash, item|
    key, value = item.split(' ')
    hash[key] = value.tr!('"', '')
    hash
  end
end