Module: Watir::AttributeHelper
- Included in:
- Element
- Defined in:
- lib/watir-webdriver/attribute_helper.rb
Overview
Extended by Element, provides methods for defining attributes on the element classes.
Constant Summary
- IGNORED_ATTRIBUTES =
[:text, :hash]
Instance Method Summary (collapse)
Instance Method Details
- (Object) attribute_list
17 18 19 20 21 22 23 24 |
# File 'lib/watir-webdriver/attribute_helper.rb', line 17 def attribute_list @attribute_list ||= ( list = typed_attributes.values.flatten list += ancestors[1..-1].map do |e| e.attribute_list if e.respond_to?(:attribute_list) end.compact.flatten ).uniq end |
- (Object) attributes(attribute_map = nil)
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/watir-webdriver/attribute_helper.rb', line 26 def attributes(attribute_map = nil) attribute_map or return attribute_list add_attributes attribute_map attribute_map.each do |type, attribs| attribs.each do |name| # we don't want to override methods like :text or :hash next if IGNORED_ATTRIBUTES.include?(name) define_attribute(type, name) end end end |
- (Object) typed_attributes
13 14 15 |
# File 'lib/watir-webdriver/attribute_helper.rb', line 13 def typed_attributes @typed_attributes ||= Hash.new { |hash, type| hash[type] = [] } end |