Class: ZFS::SnapshotList
- Inherits:
-
Object
- Object
- ZFS::SnapshotList
- Defined in:
- lib/zfs/snapshot_list.rb
Overview
Instance Method Summary collapse
- #datasets ⇒ Object
-
#initialize(tool_output) ⇒ SnapshotList
constructor
A new instance of SnapshotList.
- #snapshots(dataset_name) ⇒ Object
Constructor Details
#initialize(tool_output) ⇒ SnapshotList
Returns a new instance of SnapshotList.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/zfs/snapshot_list.rb', line 13 def initialize(tool_output) @list = Hash.new { |h,k| h[k] = [] } tool_output.lines. map { |l| l.chomp.strip.split('@').first(2) }. # extracts path/snapshot tuples each { |path, snapshot| snapshots = @list[path] snapshots << snapshot if snapshot } end |
Instance Method Details
#datasets ⇒ Object
23 24 25 |
# File 'lib/zfs/snapshot_list.rb', line 23 def datasets @list.keys end |
#snapshots(dataset_name) ⇒ Object
26 27 28 |
# File 'lib/zfs/snapshot_list.rb', line 26 def snapshots(dataset_name) @list[dataset_name] end |