Class: CapybaraPageObject::Node
- Inherits:
-
Object
- Object
- CapybaraPageObject::Node
- Includes:
- Delegators
- Defined in:
- lib/capybara-page-object/node.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
- #classes ⇒ Object
-
#initialize(source = nil) ⇒ Node
constructor
A new instance of Node.
Methods included from Delegators
Constructor Details
#initialize(source = nil) ⇒ Node
Returns a new instance of Node.
10 11 12 |
# File 'lib/capybara-page-object/node.rb', line 10 def initialize(source=nil) @source = source end |
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
8 9 10 |
# File 'lib/capybara-page-object/node.rb', line 8 def source @source end |
Class Method Details
.element(name, &block) ⇒ Object
27 28 29 |
# File 'lib/capybara-page-object/node.rb', line 27 def self.element(name, &block) define_method(name, &block) end |
.field(name, &block) ⇒ Object
31 32 33 |
# File 'lib/capybara-page-object/node.rb', line 31 def self.field(name, &block) define_method(name, &block) end |
.from_string(string, target) ⇒ Object
14 15 16 |
# File 'lib/capybara-page-object/node.rb', line 14 def self.from_string(string, target) new(Capybara.string(string).find(target)) end |
Instance Method Details
#classes ⇒ Object
18 19 20 21 |
# File 'lib/capybara-page-object/node.rb', line 18 def classes classes_list = source[:class] or return [] classes_list.split(' ') end |