Class: Howitzer::Meta::Element
- Inherits:
-
Object
- Object
- Howitzer::Meta::Element
- Includes:
- Actions
- Defined in:
- lib/howitzer/meta/element.rb
Overview
This class represents element entity within howitzer meta information interface
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#capybara_element(*args, wait: 0, **options) ⇒ Capybara::Node::Element?
Finds element on the page and returns as a capybara element.
-
#capybara_elements(*args, **options) ⇒ Array
Finds all instances of element on the page and returns them as array of capybara elements.
-
#initialize(name, context) ⇒ Element
constructor
Creates new meta element with meta information and utility actions.
Methods included from Actions
Constructor Details
#initialize(name, context) ⇒ Element
Creates new meta element with meta information and utility actions
11 12 13 14 |
# File 'lib/howitzer/meta/element.rb', line 11 def initialize(name, context) @name = name @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/howitzer/meta/element.rb', line 5 def context @context end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/howitzer/meta/element.rb', line 5 def name @name end |
Instance Method Details
#capybara_element(*args, wait: 0, **options) ⇒ Capybara::Node::Element?
Finds element on the page and returns as a capybara element
33 34 35 36 37 |
# File 'lib/howitzer/meta/element.rb', line 33 def (*args, wait: 0, **) context.send("#{name}_element", *args, **.merge(match: :first, wait: wait)) rescue Capybara::ElementNotFound nil end |
#capybara_elements(*args, **options) ⇒ Array
Finds all instances of element on the page and returns them as array of capybara elements
20 21 22 23 24 25 26 |
# File 'lib/howitzer/meta/element.rb', line 20 def (*args, **) if .present? context.send("#{name}_elements", *args, **) else context.send("#{name}_elements", *args) end end |