Class: BooticCli::Store
- Inherits:
-
Object
- Object
- BooticCli::Store
- Defined in:
- lib/bootic_cli/store.rb
Constant Summary collapse
- DIRNAME =
'.btc'.freeze
- FILE_NAME =
'store.pstore'.freeze
Instance Method Summary collapse
- #[](k) ⇒ Object
- #[]=(k, v) ⇒ Object
- #erase ⇒ Object
-
#initialize(base_dir = ENV['HOME'], dir = DIRNAME) ⇒ Store
constructor
A new instance of Store.
- #transaction(&block) ⇒ Object
Constructor Details
#initialize(base_dir = ENV['HOME'], dir = DIRNAME) ⇒ Store
Returns a new instance of Store.
11 12 13 14 |
# File 'lib/bootic_cli/store.rb', line 11 def initialize(base_dir = ENV['HOME'], dir = DIRNAME) @base_dir = File.join(base_dir, dir) FileUtils.mkdir_p @base_dir end |
Instance Method Details
#[](k) ⇒ Object
20 21 22 |
# File 'lib/bootic_cli/store.rb', line 20 def [](k) store[k] end |
#[]=(k, v) ⇒ Object
16 17 18 |
# File 'lib/bootic_cli/store.rb', line 16 def []=(k, v) store[k] = v end |
#erase ⇒ Object
28 29 30 |
# File 'lib/bootic_cli/store.rb', line 28 def erase FileUtils.rm_rf base_dir end |
#transaction(&block) ⇒ Object
24 25 26 |
# File 'lib/bootic_cli/store.rb', line 24 def transaction(&block) store.transaction(&block) end |