Class: ForemanOmaha::GroupVersionBreakdown
- Inherits:
-
Object
- Object
- ForemanOmaha::GroupVersionBreakdown
- Defined in:
- app/services/foreman_omaha/group_version_breakdown.rb
Instance Attribute Summary collapse
-
#omaha_group ⇒ Object
Returns the value of attribute omaha_group.
Instance Method Summary collapse
- #facets ⇒ Object
-
#initialize(opts = {}) ⇒ GroupVersionBreakdown
constructor
A new instance of GroupVersionBreakdown.
- #version_breakdown ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ GroupVersionBreakdown
Returns a new instance of GroupVersionBreakdown.
7 8 9 |
# File 'app/services/foreman_omaha/group_version_breakdown.rb', line 7 def initialize(opts = {}) self.omaha_group = opts.fetch(:omaha_group) end |
Instance Attribute Details
#omaha_group ⇒ Object
Returns the value of attribute omaha_group.
5 6 7 |
# File 'app/services/foreman_omaha/group_version_breakdown.rb', line 5 def omaha_group @omaha_group end |
Instance Method Details
#facets ⇒ Object
21 22 23 |
# File 'app/services/foreman_omaha/group_version_breakdown.rb', line 21 def facets ForemanOmaha::OmahaFacet.where(:omaha_group => omaha_group) end |
#version_breakdown ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/services/foreman_omaha/group_version_breakdown.rb', line 11 def version_breakdown facets.group(:version).count.sort_by { |version, _| Gem::Version.new(version) }.reverse.map do |version, count| { :version => version, :count => count, :percentage => percentage(count) } end end |