Module: CapybaraSelect2::Utils
- Defined in:
- lib/capybara_select2/utils.rb
Class Method Summary collapse
Class Method Details
.detect_select2_version(container) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/capybara_select2/utils.rb', line 4 def self.detect_select2_version(container) if container['class'] =~ /^select2\s/ '4' elsif container['id'] =~ /^s2id_/ '3' else '2' end end |
.validate_options!(options) ⇒ Object
14 15 16 17 18 |
# File 'lib/capybara_select2/utils.rb', line 14 def self.() unless .is_a?(Hash) && [:css, :xpath, :from].any? { |k| .key?(k) } fail ArgumentError.new("Please specify :css, :xpath or :from in options") end end |