Module: Capybara::IosEmulationDriver::UserAgent
- Defined in:
- lib/capybara-ios-emulation-driver/user_agent.rb
Defined Under Namespace
Modules: Ios5, Ios6, Ios7, Ios8, Ios9
Class Method Summary collapse
-
.of(params = {}) ⇒ Object
ios: 5, 6, 7, 8, 9 device: :iphone, :ipad, :ipod_touch.
Class Method Details
.of(params = {}) ⇒ Object
ios: 5, 6, 7, 8, 9 device: :iphone, :ipad, :ipod_touch
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/capybara-ios-emulation-driver/user_agent.rb', line 37 def self.of(params = {}) request = { :ios => LATEST_IOS_VERSION, :device => :iphone, }.update(params) raise unless (5..LATEST_IOS_VERSION).include?(request[:ios].to_i) raise unless %w[iphone ipad ipod_touch].include?(request[:device].to_s.downcase) case request[:device].to_s.downcase when 'iphone' self.const_get("Ios#{request[:ios].to_i}::Iphone") when 'ipad' self.const_get("Ios#{request[:ios].to_i}::Ipad") when 'ipod_touch' self.const_get("Ios#{request[:ios].to_i}::IpodTouch") end end |