module Rack::SmartphoneDetector::Checker
Public Class Methods
included(base)
click to toggle source
# File lib/rack/smartphone_detector/checker.rb, line 5 def self.included(base) def from_smartphone? !env['rack.smartphone_detector.device'].nil? end def smartphone_version env['rack.smartphone_detector.device_version'] end SMARTPHONE_IDENTIFIERS.each do |info| name = %Q{from_#{info[:identifier].downcase.gsub(' ', '_')}?} define_method(name) { env['rack.smartphone_detector.device'] == info[:identifier] } end end
Public Instance Methods
from_smartphone?()
click to toggle source
# File lib/rack/smartphone_detector/checker.rb, line 6 def from_smartphone? !env['rack.smartphone_detector.device'].nil? end
smartphone_version()
click to toggle source
# File lib/rack/smartphone_detector/checker.rb, line 10 def smartphone_version env['rack.smartphone_detector.device_version'] end