Class: ActiveInsights::JobSeeder
- Inherits:
-
Object
- Object
- ActiveInsights::JobSeeder
- Defined in:
- lib/active_insights/seeders/jobs.rb
Instance Method Summary collapse
- #find_percentile(sorted_data, percentile) ⇒ Object
-
#initialize(date, rpm, p50, p95, p99) ⇒ JobSeeder
constructor
A new instance of JobSeeder.
- #seed ⇒ Object
Constructor Details
#initialize(date, rpm, p50, p95, p99) ⇒ JobSeeder
Returns a new instance of JobSeeder.
8 9 10 11 12 13 14 |
# File 'lib/active_insights/seeders/jobs.rb', line 8 def initialize(date, rpm, p50, p95, p99) @date = date @rpm = rpm @p50 = p50 @p95 = p95 @p99 = p99 end |
Instance Method Details
#find_percentile(sorted_data, percentile) ⇒ Object
20 21 22 |
# File 'lib/active_insights/seeders/jobs.rb', line 20 def find_percentile(sorted_data, percentile) sorted_data[(percentile * sorted_data.length).ceil - 1] end |
#seed ⇒ Object
16 17 18 |
# File 'lib/active_insights/seeders/jobs.rb', line 16 def seed ActiveInsights::Job.insert_all(seed_attributes) end |