Module: Capybara::IosEmulationDriver::UserAgent
- Defined in:
- lib/capybara-ios-emulation-driver/user_agent.rb
Defined Under Namespace
Class Method Summary collapse
-
.of(params = {}) ⇒ Object
ios: 5, 6, 7 device: :iphone, :ipad, :ipod_touch.
Class Method Details
.of(params = {}) ⇒ Object
ios: 5, 6, 7 device: :iphone, :ipad, :ipod_touch
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/capybara-ios-emulation-driver/user_agent.rb', line 23 def self.of(params = {}) request = { :ios => 7, :device => :iphone, }.update(params) raise unless [5,6,7].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' # const_get "Ios#{request[:ios].to_i}::Iphone" is incompatible to Ruby 1.9 self.const_get("Ios#{request[:ios].to_i}").const_get('Iphone') when 'ipad' self.const_get("Ios#{request[:ios].to_i}").const_get('Ipad') when 'ipod_touch' self.const_get("Ios#{request[:ios].to_i}").const_get('IpodTouch') end end |