Module: Symbiont::Element
Instance Method Summary collapse
- #element(name, *identifier) ⇒ Object
- #elements(name, *identifier) ⇒ Object
- #region(name, *identifier, &block) ⇒ Object
- #regions(name, *identifier, &block) ⇒ Object
Instance Method Details
#element(name, *identifier) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/symbiont/capybara/element.rb', line 5 def element(name, *identifier) build(name, *identifier) do define_method(name.to_s) do |*| find_first(*identifier, *) end end end |
#elements(name, *identifier) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/symbiont/capybara/element.rb', line 13 def elements(name, *identifier) build(name, *identifier) do define_method(name.to_s) do |*| find_all(*identifier, *) end end end |
#region(name, *identifier, &block) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/symbiont/capybara/element.rb', line 21 def region(name, *identifier, &block) region_class, region_args = extract_region_details(identifier, &block) build(name, *region_args) do define_method(name) do |*| region_class.new(self, find_first(*region_args, *)) end end end |
#regions(name, *identifier, &block) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/symbiont/capybara/element.rb', line 31 def regions(name, *identifier, &block) region_class, region_args = extract_region_details(identifier, &block) build(name, *region_args) do define_method(name) do |*| find_all(*region_args, *).map do |element| region_class.new(self, element) end end end end |