Method: ZFS::SnapshotList#initialize
- Defined in:
- lib/zfs/snapshot_list.rb
#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 |