Class: Workarea::Segment::Rules::BrowserInfo

Inherits:
Base
  • Object
show all
Defined in:
app/models/workarea/segment/rules/browser_info.rb

Instance Method Summary collapse

Methods inherited from Base

slug

Methods included from ApplicationDocument

#releasable?

Methods included from Sidekiq::Callbacks

add_worker, assert_valid_config!, async, caching_classes?, disable, enable, inline, #run_callbacks, workers, workers_list

Methods included from Mongoid::Document

#embedded_children

Instance Method Details

#device_match?(browser) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/models/workarea/segment/rules/browser_info.rb', line 19

def device_match?(browser)
  device.any? { |d| browser.device.try("#{d}?") }
end

#general_match?(browser) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/models/workarea/segment/rules/browser_info.rb', line 15

def general_match?(browser)
  general.any? { |g| browser.try("#{g}?") }
end

#platform_match?(browser) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/models/workarea/segment/rules/browser_info.rb', line 23

def platform_match?(browser)
  platform.any? { |p| browser.platform.try("#{p}?") }
end

#qualifies?(visit) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
# File 'app/models/workarea/segment/rules/browser_info.rb', line 9

def qualifies?(visit)
  general_match?(visit.browser) ||
    device_match?(visit.browser) ||
    platform_match?(visit.browser)
end