Class: Lookout::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/lookout/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/lookout/configuration.rb', line 8

def initialize
  @goals = GoalCollection.new
  @funnels = FunnelCollection.new
  @theme = "dark"
  @return_path = "/"
  @return_copy = "← Back"
  @ranges = ::Lookout::PeriodCollection.load_default
  @cache = ActiveSupport::OrderedOptions.new.tap do |option|
    option.enabled = false
    option.store = Rails.cache
    option.ttl = 1.minute
  end
  @models = ActiveSupport::OrderedOptions.new.tap do |option|
    option.event = "::Ahoy::Event"
    option.visit = "::Ahoy::Visit"
  end
  @event = ActiveSupport::OrderedOptions.new.tap do |option|
    option.view_name = "$view"
    # Dynamically generate SQL based on database adapter
    table_name = @models.event.parameterize.tableize
    option.url_column = DatabaseAdapter.build_url_column(table_name)
    option.url_exists = DatabaseAdapter.build_url_exists(table_name)
  end
  @filters = FiltersConfiguration.load_default
  @predicate_labels = {
    eq: 'equals',
    not_eq: 'not equals',
    cont: 'contains',
    in: 'in',
    not_in: 'not in',
  }

  @realtime_interval = 30.seconds
  @disabled_widgets = []
end

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



7
8
9
# File 'lib/lookout/configuration.rb', line 7

def cache
  @cache
end

#disabled_widgetsObject

Returns the value of attribute disabled_widgets.



6
7
8
# File 'lib/lookout/configuration.rb', line 6

def disabled_widgets
  @disabled_widgets
end

#eventObject (readonly)

Returns the value of attribute event.



7
8
9
# File 'lib/lookout/configuration.rb', line 7

def event
  @event
end

#filtersObject (readonly)

Returns the value of attribute filters.



7
8
9
# File 'lib/lookout/configuration.rb', line 7

def filters
  @filters
end

#funnelsObject (readonly)

Returns the value of attribute funnels.



7
8
9
# File 'lib/lookout/configuration.rb', line 7

def funnels
  @funnels
end

#goalsObject (readonly)

Returns the value of attribute goals.



7
8
9
# File 'lib/lookout/configuration.rb', line 7

def goals
  @goals
end

#modelsObject (readonly)

Returns the value of attribute models.



7
8
9
# File 'lib/lookout/configuration.rb', line 7

def models
  @models
end

#predicate_labelsObject (readonly)

Returns the value of attribute predicate_labels.



7
8
9
# File 'lib/lookout/configuration.rb', line 7

def predicate_labels
  @predicate_labels
end

#rangesObject (readonly)

Returns the value of attribute ranges.



7
8
9
# File 'lib/lookout/configuration.rb', line 7

def ranges
  @ranges
end

#realtime_intervalObject

Returns the value of attribute realtime_interval.



6
7
8
# File 'lib/lookout/configuration.rb', line 6

def realtime_interval
  @realtime_interval
end

#return_copyObject

Returns the value of attribute return_copy.



6
7
8
# File 'lib/lookout/configuration.rb', line 6

def return_copy
  @return_copy
end

#return_pathObject

Returns the value of attribute return_path.



6
7
8
# File 'lib/lookout/configuration.rb', line 6

def return_path
  @return_path
end

#themeObject

Returns the value of attribute theme.



6
7
8
# File 'lib/lookout/configuration.rb', line 6

def theme
  @theme
end

#view_nameObject

Returns the value of attribute view_name.



6
7
8
# File 'lib/lookout/configuration.rb', line 6

def view_name
  @view_name
end

Instance Method Details

#funnel(id, &block) ⇒ Object



51
52
53
54
55
56
# File 'lib/lookout/configuration.rb', line 51

def funnel(id, &block)
  instance = Funnel.new
  instance.id = id
  instance.instance_exec(&block)
  @funnels.register(instance)
end

#goal(id, &block) ⇒ Object



44
45
46
47
48
49
# File 'lib/lookout/configuration.rb', line 44

def goal(id, &block)
  instance = Goal.new
  instance.id = id
  instance.instance_exec(&block)
  @goals.register(instance)
end