Class: ForemanStatistics::Statistics::CountPuppetClasses
- Defined in:
- app/services/foreman_statistics/statistics/count_puppet_classes.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #calculate ⇒ Object
-
#initialize(options = {}) ⇒ CountPuppetClasses
constructor
A new instance of CountPuppetClasses.
Methods inherited from Base
Constructor Details
#initialize(options = {}) ⇒ CountPuppetClasses
Returns a new instance of CountPuppetClasses.
4 5 6 7 8 9 |
# File 'app/services/foreman_statistics/statistics/count_puppet_classes.rb', line 4 def initialize( = {}) super() if id.empty? raise(ArgumentError, 'Must provide an :id or :count_by option') end end |
Instance Method Details
#calculate ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/foreman_statistics/statistics/count_puppet_classes.rb', line 11 def calculate ForemanPuppet::Puppetclass.(:view_puppetclasses).map do |pc| count = pc.hosts_count next if count.zero? { :label => pc.to_label, :data => count } end.compact end |