Module: Yerba::Node::ClassMethods
- Defined in:
- lib/yerba/node.rb
Instance Method Summary collapse
- #from(file_path:, selector:, line: nil, **attributes) ⇒ Object
- #from_document(document, selector, location = nil, key = nil, **attributes) ⇒ Object
Instance Method Details
#from(file_path:, selector:, line: nil, **attributes) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/yerba/node.rb', line 33 def from(file_path:, selector:, line: nil, **attributes) instance = allocate instance.send(:init_node, nil, selector, nil, nil, file_path, line) instance.send(:init_from, **attributes) if instance.respond_to?(:init_from, true) instance end |
#from_document(document, selector, location = nil, key = nil, **attributes) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/yerba/node.rb', line 24 def from_document(document, selector, location = nil, key = nil, **attributes) instance = allocate instance.send(:init_node, document, selector, location, key, nil, nil) instance.send(:init_from, **attributes) if instance.respond_to?(:init_from, true) instance end |