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.
27 28 29 30 |
# File 'lib/user_agent_parser/parser.rb', line 27 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.
25 26 27 |
# File 'lib/user_agent_parser/parser.rb', line 25 def patterns_path @patterns_path end |
Instance Method Details
#parse(user_agent) ⇒ Object
32 33 34 35 36 |
# File 'lib/user_agent_parser/parser.rb', line 32 def parse(user_agent) os = parse_os(user_agent) device = parse_device(user_agent) parse_ua(user_agent, os, device) end |