Class: UserAgentParser::Parser
- Inherits:
-
Object
- Object
- UserAgentParser::Parser
- Defined in:
- lib/user_agent_parser/parser.rb
Instance Attribute Summary collapse
-
#patterns_path ⇒ Object
readonly
Returns the value of attribute patterns_path.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Parser
constructor
A new instance of Parser.
- #parse(user_agent) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Parser
Returns a new instance of Parser.
8 9 10 11 |
# File 'lib/user_agent_parser/parser.rb', line 8 def initialize(={}) @patterns_path = [:patterns_path] || UserAgentParser::DefaultPatternsPath @ua_patterns, @os_patterns, @device_patterns = load_patterns(patterns_path) end |
Instance Attribute Details
#patterns_path ⇒ Object (readonly)
Returns the value of attribute patterns_path.
6 7 8 |
# File 'lib/user_agent_parser/parser.rb', line 6 def patterns_path @patterns_path end |
Instance Method Details
#parse(user_agent) ⇒ Object
13 14 15 16 17 |
# File 'lib/user_agent_parser/parser.rb', line 13 def parse(user_agent) os = parse_os(user_agent) device = parse_device(user_agent) parse_ua(user_agent, os, device) end |