Class: UserAgentParser::Parser::Patterns
- Inherits:
-
Object
- Object
- UserAgentParser::Parser::Patterns
- Defined in:
- lib/hacks/user_agent_parser.rb
Instance Method Summary collapse
- #get(path = nil) ⇒ Object
-
#initialize ⇒ Patterns
constructor
A new instance of Patterns.
Constructor Details
#initialize ⇒ Patterns
Returns a new instance of Patterns.
10 11 12 13 |
# File 'lib/hacks/user_agent_parser.rb', line 10 def initialize @cache = {} get # warm the cache for the default patterns end |
Instance Method Details
#get(path = nil) ⇒ Object
15 16 17 18 |
# File 'lib/hacks/user_agent_parser.rb', line 15 def get(path = nil) path = UserAgentParser::DefaultPatternsPath if path.nil? @cache[path] ||= load_and_parse(path) end |