Sha256: e6f3d3a5163f1e90770a537b71e9f350772696a8127c1098046e7556f456dd04
Contents?: true
Size: 832 Bytes
Versions: 2
Compression:
Stored size: 832 Bytes
Contents
module Oxidized class Script module Command class ListNodes Name = 'list-nodes' Description = 'list nodes in oxidized source' def self.run opts={} puts new(opts).nodes exit end def nodes out = '' Nodes.new.each do |node| out += "#{node.name}:\n" node.instance_variables.each do |var| name = var.to_s[1..-1] next if name == 'name' value = node.instance_variable_get var value = value.class if name == 'model' out += " %10s => %s\n" % [name, value.to_s] end end out end private def initialize opts={} Oxidized.mgr = Manager.new end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
oxidized-script-0.0.4 | lib/oxidized/script/commands/list-nodes.rb |
oxidized-script-0.0.3 | lib/oxidized/script/commands/list-nodes.rb |