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.
Instance Method Summary collapse
-
#attribute(type, method, attr) ⇒ type
YARD macro to generated friendly documentation for attributes.
- #attribute_list ⇒ Object (also: #attributes)
- #inherit_attributes_from(kls) ⇒ Object
-
#method ⇒ type
YARD macro to generated friendly documentation for attributes.
- #typed_attributes ⇒ Object
Instance Method Details
#attribute(type, method, attr) ⇒ type
YARD macro to generated friendly documentation for attributes.
40 41 42 43 |
# File 'lib/watir-webdriver/attribute_helper.rb', line 40 def attribute(type, method, attr) typed_attributes[type] << [method, attr] define_attribute(type, method, attr) end |
#attribute_list ⇒ Object Also known as: attributes
21 22 23 24 25 26 27 28 |
# File 'lib/watir-webdriver/attribute_helper.rb', line 21 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 |
#inherit_attributes_from(kls) ⇒ Object
11 12 13 14 15 |
# File 'lib/watir-webdriver/attribute_helper.rb', line 11 def inherit_attributes_from(kls) kls.typed_attributes.each do |type, attrs| attrs.each { |method, attr| attribute type, method, attr } end end |
#method ⇒ type
YARD macro to generated friendly documentation for attributes.
40 41 42 43 |
# File 'lib/watir-webdriver/attribute_helper.rb', line 40 def attribute(type, method, attr) typed_attributes[type] << [method, attr] define_attribute(type, method, attr) end |
#typed_attributes ⇒ Object
17 18 19 |
# File 'lib/watir-webdriver/attribute_helper.rb', line 17 def typed_attributes @typed_attributes ||= Hash.new { |hash, type| hash[type] = [] } end |