Sha256: f103289a795314dca4e03f9c7691651e5a3c86994867ddf9e13ed2139e0e6760

Contents?: true

Size: 422 Bytes

Versions: 43

Compression:

Stored size: 422 Bytes

Contents

class DF
	
	include RunCommand
	
	command :df, :k => ""
	
	def data
		headers = false
		output = []
		command_output.split("\n").map {|line| line.split("\s") }.each do |line|
			if !headers
				headers = line.map {|hdr| hdr.downcase.to_sym}
				headers.pop
				next
			end
			next unless headers
			pkt = {}
			line.each_with_index do |itm,idx|
				pkt[headers[idx]] = itm
			end
			output << pkt
		end
		output
	end
	
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
city-watch-0.3.2 lib/city_watch/commands/df.rb
city-watch-0.3.1 lib/city_watch/commands/df.rb
city-watch-0.3.0 lib/city_watch/commands/df.rb