Module: ActiveInsights::ApplicationHelper
- Defined in:
- app/helpers/active_insights/application_helper.rb
Instance Method Summary collapse
- #active_insights_importmap_tags ⇒ Object
- #display_date(date) ⇒ Object
- #p50(data) ⇒ Object
- #p95(data) ⇒ Object
- #p99(data) ⇒ Object
- #per_minute(amount, duration) ⇒ Object
Instance Method Details
#active_insights_importmap_tags ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'app/helpers/active_insights/application_helper.rb', line 5 def importmap = ActiveInsights::Engine.importmap safe_join [ javascript_inline_importmap_tag(importmap.to_json(resolver: self)), (importmap), ], "\n" end |
#display_date(date) ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/helpers/active_insights/application_helper.rb', line 14 def display_date(date) if Date.current.year == date.year date.strftime("%B %-d") else date.strftime("%B %-d, %Y") end end |
#p50(data) ⇒ Object
22 23 24 |
# File 'app/helpers/active_insights/application_helper.rb', line 22 def p50(data) percentile_value(data, 0.5) end |
#p95(data) ⇒ Object
26 27 28 |
# File 'app/helpers/active_insights/application_helper.rb', line 26 def p95(data) percentile_value(data, 0.95) end |
#p99(data) ⇒ Object
30 31 32 |
# File 'app/helpers/active_insights/application_helper.rb', line 30 def p99(data) percentile_value(data, 0.99) end |
#per_minute(amount, duration) ⇒ Object
34 35 36 |
# File 'app/helpers/active_insights/application_helper.rb', line 34 def per_minute(amount, duration) (amount / duration.in_minutes).round(1) end |