Class: Capybarista::Element
- Inherits:
-
Object
- Object
- Capybarista::Element
- Includes:
- Capybarista::Extensions::Element, Finders
- Defined in:
- lib/capybarista.rb
Instance Attribute Summary collapse
-
#basis ⇒ Object
readonly
Returns the value of attribute basis.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(element, session) ⇒ Element
constructor
A new instance of Element.
- #method_missing(name, *args, &block) ⇒ Object
Methods included from Capybarista::Extensions::Element
#blur, #filtered_attributes, #focus, #highlight, #inner_html, #label, #label!, #labels, #outer_html, #scoped, #top_left, #unique_xpath
Methods included from Capybarista::Extensions::Base
Methods included from Finders
#all, #find, #find_button, #find_by_id, #find_field, #find_link, #first
Constructor Details
#initialize(element, session) ⇒ Element
Returns a new instance of Element.
80 81 82 83 |
# File 'lib/capybarista.rb', line 80 def initialize(element, session) @basis = element @session = session end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
104 105 106 |
# File 'lib/capybarista.rb', line 104 def method_missing(name, *args, &block) @basis.public_send(name, *args, &block) end |
Instance Attribute Details
#basis ⇒ Object (readonly)
Returns the value of attribute basis.
78 79 80 |
# File 'lib/capybarista.rb', line 78 def basis @basis end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
78 79 80 |
# File 'lib/capybarista.rb', line 78 def session @session end |
Class Method Details
.for(input, session = nil) ⇒ Object
85 86 87 88 89 90 91 92 |
# File 'lib/capybarista.rb', line 85 def self.for(input, session = nil) if input.is_a? ::Element return input else session ||= ::Session.new(input.session) return ::Element.new input end end |
.unwrap(input) ⇒ Object
95 96 97 98 99 100 |
# File 'lib/capybarista.rb', line 95 def self.unwrap(input) while input.is_a? ::Element input = input.basis end input end |