Class: Browser::Device::Samsung
- Inherits:
-
Base
- Object
- Base
- Browser::Device::Samsung
show all
- Defined in:
- lib/browser/device/samsung.rb
Constant Summary
collapse
- REGEX =
/\(Linux.*?; Android.*?; (SAMSUNG )?(SM-[A-Z0-9]+).*?\)/i.freeze
Instance Attribute Summary
Attributes inherited from Base
#ua
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Class Method Details
.names ⇒ Object
8
9
10
|
# File 'lib/browser/device/samsung.rb', line 8
def self.names
@names ||= YAML.load_file(Browser.root.join("samsung.yml").to_s)
end
|
Instance Method Details
#code ⇒ Object
20
21
22
|
# File 'lib/browser/device/samsung.rb', line 20
def code
matches && matches[2]
end
|
#id ⇒ Object
12
13
14
|
# File 'lib/browser/device/samsung.rb', line 12
def id
:samsung
end
|
#match? ⇒ Boolean
28
29
30
|
# File 'lib/browser/device/samsung.rb', line 28
def match?
!!matches
end
|
#matches ⇒ Object
24
25
26
|
# File 'lib/browser/device/samsung.rb', line 24
def matches
@matches ||= ua.match(REGEX)
end
|
#name ⇒ Object
16
17
18
|
# File 'lib/browser/device/samsung.rb', line 16
def name
"Samsung #{self.class.names[code] || code}"
end
|