Class: Picobox::Shell::IniFile
- Inherits:
-
Object
- Object
- Picobox::Shell::IniFile
- Defined in:
- lib/picobox/shell/ini_file.rb
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(section, value) ⇒ Object
-
#initialize(os) ⇒ IniFile
constructor
A new instance of IniFile.
- #install ⇒ Object
Constructor Details
#initialize(os) ⇒ IniFile
Returns a new instance of IniFile.
10 11 12 |
# File 'lib/picobox/shell/ini_file.rb', line 10 def initialize(os) @os = os end |
Class Method Details
.get(os) ⇒ Object
5 6 7 |
# File 'lib/picobox/shell/ini_file.rb', line 5 def get(os) self.new(os) end |
Instance Method Details
#[](key) ⇒ Object
21 22 23 |
# File 'lib/picobox/shell/ini_file.rb', line 21 def [](key) ini_file[key] end |
#[]=(section, value) ⇒ Object
26 27 28 29 |
# File 'lib/picobox/shell/ini_file.rb', line 26 def []=(section, value) ini_file[section.to_s] = value ini_file.save end |
#install ⇒ Object
14 15 16 17 18 |
# 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 |