Sha256: f8b836ad6ec155d44a982ad9be1d12de09641626184482da32f536247379b558
Contents?: true
Size: 451 Bytes
Versions: 3
Compression:
Stored size: 451 Bytes
Contents
module Napybara class Selector < Struct.new(:child_element_selector, :record_selector, :record) METHOD_NAME_REGEX = /\{(\w+)\}/ def method_name record_selector.match(METHOD_NAME_REGEX)[1] end def record_id record && record.public_send(method_name) end def to_s if record record_selector.gsub(METHOD_NAME_REGEX, record_id.to_s) else child_element_selector end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
napybara-0.7.0 | lib/napybara/selector.rb |
napybara-0.6.0 | lib/napybara/selector.rb |
napybara-0.5.0 | lib/napybara/selector.rb |