Module: Unobtainium::Support::Utility Private
- Included in:
- Drivers::Appium, Drivers::Phantom, Drivers::Selenium
- Defined in:
- lib/unobtainium/support/util.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Utility code shared by driver implementations
Instance Method Summary collapse
-
#normalize_label(label) ⇒ Object
private
For a recognized label alias, returns a normalized label.
Instance Method Details
#normalize_label(label) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
For a recognized label alias, returns a normalized label. Requires the enclosing class to provide a LABELS connstant that is a hash where keys are the normalized label, and the value is an array of aliases:
“‘ruby
LABELS = {
foo: [:alias1, :alias2],
bar: [],
}.freeze
“‘
Empty aliases means that there are no aliases for this label.
32 33 34 35 36 37 38 39 40 |
# File 'lib/unobtainium/support/util.rb', line 32 def normalize_label(label) sym_label = label.to_sym self::LABELS.each do |normalized, aliases| if sym_label == normalized or aliases.include?(sym_label) return normalized end end return nil end |