class Picobox::Shell::IniFile

Attributes

os[R]

Public Class Methods

get(os) click to toggle source
# File lib/picobox/shell/ini_file.rb, line 5
def get(os)
  self.new(os)
end
new(os) click to toggle source
# File lib/picobox/shell/ini_file.rb, line 10
def initialize(os)
  @os = os
end

Public Instance Methods

[](key) click to toggle source
# File lib/picobox/shell/ini_file.rb, line 21
def [](key)
  ini_file[key]
end
[]=(section, value) click to toggle source
# File lib/picobox/shell/ini_file.rb, line 26
def []=(section, value)
  ini_file[section.to_s] = value
  ini_file.save
end
install() click to toggle source
# File lib/picobox/shell/ini_file.rb, line 14
def install
  TTY::File.create_file filename do |content|
    "[packages]\nversion=v0.0\nlast_update=#{Time.now.to_i}\n"
  end unless File.exist? filename
end

Private Instance Methods

filename() click to toggle source
# File lib/picobox/shell/ini_file.rb, line 34
def filename() "#{os.config_dir}/#{Picobox::PICOBOX_INI}" end
ini_file() click to toggle source
# File lib/picobox/shell/ini_file.rb, line 35
def ini_file() @ini_file ||= ::IniFile.load(filename) end