Module: Watir

Defined in:
lib/watir-formhandler/radio.rb,
lib/watir-formhandler/watir.rb,
lib/watir-formhandler/select.rb,
lib/watir-formhandler/element.rb,
lib/watir-formhandler/check_box.rb,
lib/watir-formhandler/container.rb,
lib/watir-formhandler/text_area.rb,
lib/watir-formhandler/file_field.rb,
lib/watir-formhandler/text_field.rb,
lib/watir-formhandler/option_group.rb

Defined Under Namespace

Modules: Container Classes: CheckBox, Element, FileField, HTMLElement, OptionGroup, Radio, Select, TextArea, TextField

Class Method Summary collapse

Class Method Details

.extend_tag_to_class(tag, tag_class) ⇒ Hash

As the tag_to_class hash is frozen once Watir is done loading its base classes, it cannot be extended with custom classes. Therefore, extend_tag_to_class unfreezes it, by replacing it with a duplicate and freezing it again after the addition.

Parameters:

  • tag (Symbol)

    the tag to add to the list.

  • tag_class (Element)

    the element class to return for the given tag.

Returns:

  • (Hash)

    the new tag-class hash.



9
10
11
12
# File 'lib/watir-formhandler/watir.rb', line 9

def self.extend_tag_to_class(tag, tag_class)
  @tag_to_class = @tag_to_class.dup.merge(tag => tag_class)
  @tag_to_class.freeze
end