summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/outputs.rb
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2014-08-07 14:33:18 +0300
committerSaku Ytti <saku@ytti.fi>2014-08-07 14:33:18 +0300
commit7aa9299971a2cacad29ab86e82cc780354d659e0 (patch)
treec932d85d28b2c6d654e3bfff75db00b6906c9af4 /lib/oxidized/model/outputs.rb
parent2a77796a7caf10601ae8edea5bf996f951694985 (diff)
Keep config as Oxidized::Config instead of hash
The model will look like this: cmd 'show ip cef' do |out| out.type = 'poop' out end cmd 'show process cpu' do |out| out.type = 'poop' out end cmd 'show memory statistics' do |out| out.type = 'poop' out end I think it's cleaner.
Diffstat (limited to 'lib/oxidized/model/outputs.rb')
-rw-r--r--lib/oxidized/model/outputs.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/oxidized/model/outputs.rb b/lib/oxidized/model/outputs.rb
index 5ef9bc4..406f886 100644
--- a/lib/oxidized/model/outputs.rb
+++ b/lib/oxidized/model/outputs.rb
@@ -7,13 +7,7 @@ module Oxidized
end
def type_to_str want_type
- type(want_type).map { |h| h[:output] }.join
- end
-
- def each_type &block
- types.each do |want_type|
- yield [want_type, type(want_type)]
- end
+ type(want_type).map { |out| out }.join
end
def << output
@@ -25,11 +19,11 @@ module Oxidized
end
def type type
- @outputs.select { |h| h[:type]==type }
+ @outputs.select { |out| out.type==type }
end
def types
- @outputs.map { |h| h[:type] }.uniq
+ @outputs.map { |out| out.type }.uniq - ['cfg']
end
private