class DeviceDetector::VersionExtractor
Constants
- MAJOR_VERSION_2
- MAJOR_VERSION_3
- MAJOR_VERSION_4
- MAJOR_VERSION_8
Public Instance Methods
call()
click to toggle source
Calls superclass method
DeviceDetector::MetadataExtractor#call
# File lib/device_detector/version_extractor.rb, line 10 def call simple_version = super&.chomp('.') return simple_version unless simple_version&.empty? os_version_by_regexes end
Private Instance Methods
metadata_string()
click to toggle source
# File lib/device_detector/version_extractor.rb, line 35 def metadata_string String(regex_meta[:version]) end
os_version_by_regexes()
click to toggle source
# File lib/device_detector/version_extractor.rb, line 20 def os_version_by_regexes version_matches = regex_meta[:versions] return '' unless version_matches version_matches.detect do |matcher| user_agent.match(matcher[:regex]) do |match_data| return matcher[:version].gsub(/\$(\d)/) do match_data[Regexp.last_match(1).to_i].to_s end.strip end end '' end