Class: SimpleAnalyticsRails::Configuration
- Inherits:
-
Object
- Object
- SimpleAnalyticsRails::Configuration
- Defined in:
- lib/simple_analytics_rails/configuration.rb
Instance Attribute Summary collapse
-
#auto_collect ⇒ Object
writeonly
Sets the attribute auto_collect.
-
#collect_dnt ⇒ Object
writeonly
Sets the attribute collect_dnt.
-
#custom_domain ⇒ Object
writeonly
Sets the attribute custom_domain.
-
#enabled ⇒ Object
writeonly
Sets the attribute enabled.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#ignore_pages ⇒ Object
Returns the value of attribute ignore_pages.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#onload_callback ⇒ Object
Returns the value of attribute onload_callback.
-
#sa_global ⇒ Object
Returns the value of attribute sa_global.
Instance Method Summary collapse
- #auto_collect? ⇒ Boolean
- #collect_dnt? ⇒ Boolean
- #custom_sa_global? ⇒ Boolean
- #enabled? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #noscript_domain ⇒ Object
- #onload_callback? ⇒ Boolean
- #script_domain ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/simple_analytics_rails/configuration.rb', line 3 def initialize @hostname = "" @mode = "" @ignore_pages = "" @collect_dnt = false @enabled = true @custom_domain = "" @auto_collect = true @sa_global = "sa_event" @onload_callback = "" end |
Instance Attribute Details
#auto_collect=(value) ⇒ Object (writeonly)
Sets the attribute auto_collect
43 44 45 |
# File 'lib/simple_analytics_rails/configuration.rb', line 43 def auto_collect=(value) @auto_collect = value end |
#collect_dnt=(value) ⇒ Object (writeonly)
Sets the attribute collect_dnt
24 25 26 |
# File 'lib/simple_analytics_rails/configuration.rb', line 24 def collect_dnt=(value) @collect_dnt = value end |
#custom_domain=(value) ⇒ Object (writeonly)
Sets the attribute custom_domain
34 35 36 |
# File 'lib/simple_analytics_rails/configuration.rb', line 34 def custom_domain=(value) @custom_domain = value end |
#enabled=(value) ⇒ Object (writeonly)
Sets the attribute enabled
29 30 31 |
# File 'lib/simple_analytics_rails/configuration.rb', line 29 def enabled=(value) @enabled = value end |
#hostname ⇒ Object
Returns the value of attribute hostname.
16 17 18 |
# File 'lib/simple_analytics_rails/configuration.rb', line 16 def hostname @hostname end |
#ignore_pages ⇒ Object
Returns the value of attribute ignore_pages.
15 16 17 |
# File 'lib/simple_analytics_rails/configuration.rb', line 15 def ignore_pages @ignore_pages end |
#mode ⇒ Object
Returns the value of attribute mode.
17 18 19 |
# File 'lib/simple_analytics_rails/configuration.rb', line 17 def mode @mode end |
#onload_callback ⇒ Object
Returns the value of attribute onload_callback.
48 49 50 |
# File 'lib/simple_analytics_rails/configuration.rb', line 48 def onload_callback @onload_callback end |
#sa_global ⇒ Object
Returns the value of attribute sa_global.
18 19 20 |
# File 'lib/simple_analytics_rails/configuration.rb', line 18 def sa_global @sa_global end |
Instance Method Details
#auto_collect? ⇒ Boolean
44 45 46 |
# File 'lib/simple_analytics_rails/configuration.rb', line 44 def auto_collect? @auto_collect end |
#collect_dnt? ⇒ Boolean
25 26 27 |
# File 'lib/simple_analytics_rails/configuration.rb', line 25 def collect_dnt? @collect_dnt end |
#custom_sa_global? ⇒ Boolean
20 21 22 |
# File 'lib/simple_analytics_rails/configuration.rb', line 20 def custom_sa_global? @sa_global != "sa_event" end |
#enabled? ⇒ Boolean
30 31 32 |
# File 'lib/simple_analytics_rails/configuration.rb', line 30 def enabled? @enabled end |
#noscript_domain ⇒ Object
39 40 41 |
# File 'lib/simple_analytics_rails/configuration.rb', line 39 def noscript_domain @custom_domain.present? ? @custom_domain : "queue.simpleanalyticscdn.com" end |
#onload_callback? ⇒ Boolean
49 50 51 |
# File 'lib/simple_analytics_rails/configuration.rb', line 49 def onload_callback? @onload_callback.present? end |
#script_domain ⇒ Object
35 36 37 |
# File 'lib/simple_analytics_rails/configuration.rb', line 35 def script_domain @custom_domain.present? ? @custom_domain : "scripts.simpleanalyticscdn.com" end |
#to_h ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/simple_analytics_rails/configuration.rb', line 53 def to_h { sa_global: custom_sa_global? ? sa_global : nil, auto_collect: auto_collect? ? nil : "false", hostname: @hostname, mode: @mode, collect_dnt: collect_dnt? ? "true" : nil, ignore_pages: @ignore_pages, turbolinks_track: turbolinks_track }.compact.reject { |_key, value| value.blank? } end |