Module: Wiselinks::Request

Defined in:
lib/wiselinks/request.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
# File 'lib/wiselinks/request.rb', line 3

def self.included(base)
  base.alias_method_chain :referer, :wiselinks
  base.alias_method_chain :referrer, :wiselinks
end

Instance Method Details



8
9
10
# File 'lib/wiselinks/request.rb', line 8

def referer_with_wiselinks
  self.headers['X-Wiselinks-Referer'] || self.referer_without_wiselinks
end


12
13
14
# File 'lib/wiselinks/request.rb', line 12

def referrer_with_wiselinks
  self.referer_with_wiselinks
end

#wiselinks?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/wiselinks/request.rb', line 16

def wiselinks?
  self.headers['X-Wiselinks'].present?
end

Returns:

  • (Boolean)


24
25
26
# File 'lib/wiselinks/request.rb', line 24

def wiselinks_partial?
  self.wiselinks? && self.headers['X-Wiselinks'] == 'partial'
end

Returns:

  • (Boolean)


20
21
22
# File 'lib/wiselinks/request.rb', line 20

def wiselinks_template?
  self.wiselinks? && self.headers['X-Wiselinks'] != 'partial'
end