1. Ruby / Говнокод #18780

    −66

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    def perform
      ...
      settings = get_settings
      @browser = Selenium::WebDriver.for(settings.delete(:driver).try(:to_sym), settings)
      ...
    end
    
    def get_settings
      settings = Settings.get('selenium_terminal').map{ |(k, e)| k == 'desired_capabilities' && [k.to_sym, e.to_sym] || [k.to_sym, e] }
      Hash[settings] rescue nil
    end

    Запостил: darkdemiurge, 29 Сентября 2015

    Комментарии (1) RSS

    • Hash[settings] спешит на помощь nil-у.
      Кавабанга!
      Ответить

    Добавить комментарий