Class: Napybara::Selector
- Inherits:
-
Struct
- Object
- Struct
- Napybara::Selector
- Defined in:
- lib/napybara/selector.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
2 3 4 |
# File 'lib/napybara/selector.rb', line 2 def child_element_selector @child_element_selector end |
#record ⇒ Object
Returns the value of attribute record
2 3 4 |
# File 'lib/napybara/selector.rb', line 2 def record @record end |
#record_selector ⇒ Object
Returns the value of attribute record_selector
2 3 4 |
# File 'lib/napybara/selector.rb', line 2 def record_selector @record_selector end |
Instance Method Details
#method_name ⇒ Object
4 5 6 |
# File 'lib/napybara/selector.rb', line 4 def method_name record_selector.match(METHOD_NAME_REGEX)[1] end |
#record_id ⇒ Object
8 9 10 |
# File 'lib/napybara/selector.rb', line 8 def record_id record && record.public_send(method_name) end |
#to_s ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/napybara/selector.rb', line 12 def to_s if record record_selector.gsub(METHOD_NAME_REGEX, record_id.to_s) else child_element_selector end end |