Class: Riddler::ContextBuilders::UserAgentDrop

Inherits:
Liquid::Drop
  • Object
show all
Defined in:
lib/riddler/context_builders/user_agent.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user_agent) ⇒ UserAgentDrop

Returns a new instance of UserAgentDrop.



18
19
20
21
# File 'lib/riddler/context_builders/user_agent.rb', line 18

def initialize user_agent
  @user_agent = user_agent
  @browser = Browser.new user_agent
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *_args) ⇒ Object



27
28
29
30
# File 'lib/riddler/context_builders/user_agent.rb', line 27

def method_missing method, *_args
  return super unless browser.respond_to? method
  liquid_method_missing method
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



16
17
18
# File 'lib/riddler/context_builders/user_agent.rb', line 16

def browser
  @browser
end

#user_agentObject (readonly)

Returns the value of attribute user_agent.



16
17
18
# File 'lib/riddler/context_builders/user_agent.rb', line 16

def user_agent
  @user_agent
end

Instance Method Details

#liquid_method_missing(method) ⇒ Object



23
24
25
# File 'lib/riddler/context_builders/user_agent.rb', line 23

def liquid_method_missing method
  browser.public_send method
end