Class: Napybara::Element::Selector
- Inherits:
-
Struct
- Object
- Struct
- Napybara::Element::Selector
- Defined in:
- lib/napybara/element.rb
Constant Summary collapse
- METHOD_NAME_REGEX =
/\{(\w+)\}/
Instance Attribute Summary collapse
-
#child_element_selector ⇒ Object
Returns the value of attribute child_element_selector.
-
#record ⇒ Object
Returns the value of attribute record.
-
#record_selector ⇒ Object
Returns the value of attribute record_selector.
Instance Method Summary collapse
Instance Attribute Details
#child_element_selector ⇒ Object
Returns the value of attribute child_element_selector
36 37 38 |
# File 'lib/napybara/element.rb', line 36 def child_element_selector @child_element_selector end |
#record ⇒ Object
Returns the value of attribute record
36 37 38 |
# File 'lib/napybara/element.rb', line 36 def record @record end |
#record_selector ⇒ Object
Returns the value of attribute record_selector
36 37 38 |
# File 'lib/napybara/element.rb', line 36 def record_selector @record_selector end |
Instance Method Details
#method_name ⇒ Object
38 39 40 |
# File 'lib/napybara/element.rb', line 38 def method_name record_selector.match(METHOD_NAME_REGEX)[1] end |
#record_id ⇒ Object
42 43 44 |
# File 'lib/napybara/element.rb', line 42 def record_id record && record.public_send(method_name) end |
#to_s ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/napybara/element.rb', line 46 def to_s if record record_selector.gsub(METHOD_NAME_REGEX, record_id.to_s) else child_element_selector end end |