Class: Matey::BrowserOsBreakdownComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Matey::BrowserOsBreakdownComponent
- Defined in:
- app/components/matey/browser_os_breakdown_component.rb
Instance Method Summary collapse
-
#initialize(visits:, time_window:, color_scheme: "neutral") ⇒ BrowserOsBreakdownComponent
constructor
A new instance of BrowserOsBreakdownComponent.
Methods inherited from ApplicationComponent
Methods included from ColorSchemeHelper
Constructor Details
#initialize(visits:, time_window:, color_scheme: "neutral") ⇒ BrowserOsBreakdownComponent
Returns a new instance of BrowserOsBreakdownComponent.
2 3 4 5 6 7 8 9 10 |
# File 'app/components/matey/browser_os_breakdown_component.rb', line 2 def initialize(visits:, time_window:, color_scheme: "neutral") visits_in_time_window = visits.where(started_at: time_window.ago..) @visits_in_time_window = visits_in_time_window.count @browsers = visits_in_time_window.group(:browser).count @operating_systems = visits_in_time_window.group(:os).count @time_window = time_window @color_scheme = color_scheme(scheme: color_scheme) end |