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
39 40 41 42 43 44 45 46 |
# File 'lib/yerba/node.rb', line 39 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
30 31 32 33 34 35 36 37 |
# File 'lib/yerba/node.rb', line 30 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 |