Class: Sentiero::Web::Views::FunnelView

Inherits:
BaseView
  • Object
show all
Defined in:
lib/sentiero/web/views/funnel_view.rb

Constant Summary

Constants inherited from BaseView

BaseView::TEMPLATES_DIR, BaseView::TEMPLATE_CACHE

Constants included from Escaping

Escaping::HTML_UNSAFE_IN_SCRIPT, Escaping::HTML_UNSAFE_IN_SCRIPT_PATTERN

Instance Attribute Summary collapse

Attributes inherited from BaseView

#base_path, #csrf_token

Instance Method Summary collapse

Methods inherited from BaseView

#built_asset, compiled_template, #escape_js, #h, #range_pairs, #render, #render_layout, #render_partial, #render_session_row

Methods included from Formatting

#format_duration, #format_vital, #parse_browser, #parse_device

Methods included from Escaping

#escape_html, #escape_js_string, #escape_json

Constructor Details

#initialize(tags:, selected_steps:, steps:, was_truncated:, since:, until_str:) ⇒ FunnelView

Returns a new instance of FunnelView.



9
10
11
12
13
14
15
16
17
# File 'lib/sentiero/web/views/funnel_view.rb', line 9

def initialize(tags:, selected_steps:, steps:, was_truncated:, since:, until_str:)
  super()
  @tags = tags
  @selected_steps = selected_steps
  @steps = steps
  @was_truncated = was_truncated
  @since = since
  @until_str = until_str
end

Instance Attribute Details

#selected_stepsObject (readonly)

Returns the value of attribute selected_steps.



19
20
21
# File 'lib/sentiero/web/views/funnel_view.rb', line 19

def selected_steps
  @selected_steps
end

#sinceObject (readonly)

Returns the value of attribute since.



19
20
21
# File 'lib/sentiero/web/views/funnel_view.rb', line 19

def since
  @since
end

#stepsObject (readonly)

Returns the value of attribute steps.



19
20
21
# File 'lib/sentiero/web/views/funnel_view.rb', line 19

def steps
  @steps
end

#tagsObject (readonly)

Returns the value of attribute tags.



19
20
21
# File 'lib/sentiero/web/views/funnel_view.rb', line 19

def tags
  @tags
end

#until_strObject (readonly)

Returns the value of attribute until_str.



19
20
21
# File 'lib/sentiero/web/views/funnel_view.rb', line 19

def until_str
  @until_str
end

#was_truncatedObject (readonly)

Returns the value of attribute was_truncated.



19
20
21
# File 'lib/sentiero/web/views/funnel_view.rb', line 19

def was_truncated
  @was_truncated
end

Instance Method Details

#dropped(i) ⇒ Object



29
30
31
32
# File 'lib/sentiero/web/views/funnel_view.rb', line 29

def dropped(i)
  n = next_step(i)
  n ? steps[i][:sessions] - n[:sessions] : 0
end

#format_gap(ms) ⇒ Object



23
# File 'lib/sentiero/web/views/funnel_view.rb', line 23

def format_gap(ms) = (ms < 1000) ? "#{ms.round}ms" : format_duration(0, ms)

#next_step(i) ⇒ Object



27
# File 'lib/sentiero/web/views/funnel_view.rb', line 27

def next_step(i) = steps[i + 1]

#step_one_sessionsObject



25
# File 'lib/sentiero/web/views/funnel_view.rb', line 25

def step_one_sessions = @step_one_sessions ||= steps.first&.fetch(:sessions).to_i

#templateObject



21
# File 'lib/sentiero/web/views/funnel_view.rb', line 21

def template = "analytics_funnel.html.erb"