Class: DeviceDetector::Parser
- Inherits:
-
Object
- Object
- DeviceDetector::Parser
- Defined in:
- lib/device_detector/parser.rb
Direct Known Subclasses
Bot, Client, Device, OS, VendorFragment
Constant Summary collapse
- ROOT =
File.('../..', __dir__)
Instance Attribute Summary collapse
-
#user_agent ⇒ Object
readonly
Returns the value of attribute user_agent.
Instance Method Summary collapse
- #full_version ⇒ Object
-
#initialize(user_agent) ⇒ Parser
constructor
A new instance of Parser.
- #name ⇒ Object
Constructor Details
#initialize(user_agent) ⇒ Parser
Returns a new instance of Parser.
10 11 12 |
# File 'lib/device_detector/parser.rb', line 10 def initialize(user_agent) @user_agent = user_agent end |
Instance Attribute Details
#user_agent ⇒ Object (readonly)
Returns the value of attribute user_agent.
14 15 16 |
# File 'lib/device_detector/parser.rb', line 14 def user_agent @user_agent end |
Instance Method Details
#full_version ⇒ Object
22 23 24 25 26 |
# File 'lib/device_detector/parser.rb', line 22 def full_version from_cache(['full_version', self.class.name, user_agent]) do VersionExtractor.new(user_agent, ).call end end |
#name ⇒ Object
16 17 18 19 20 |
# File 'lib/device_detector/parser.rb', line 16 def name from_cache(['name', self.class.name, user_agent]) do NameExtractor.new(user_agent, ).call end end |