Class: Scrubyt::ConstraintAdder
- Inherits:
-
Object
- Object
- Scrubyt::ConstraintAdder
- Defined in:
- lib/scrubyt/core/scraping/constraint_adder.rb
Overview
Utility class for adding constraints
Originally methods of Pattern - but since Pattern was already too heavy (and after all, adding a constraint (logically) does not belong to Pattern anyway) it was moved to this utility class. In pattern everything that begins with ensure_ is automatically dispatched here.
I will not document the functions since these are just forwarders; See the ‘real’ functions with their documentation in Scrubyt::Constraint.rb
Class Method Summary collapse
- .ensure_absence_of_ancestor_node(ancestor_node_name, attributes = []) ⇒ Object
- .ensure_absence_of_attribute(attribute_hash) ⇒ Object
- .ensure_presence_of_ancestor_node(ancestor_node_name, attributes = []) ⇒ Object
- .ensure_presence_of_attribute(attribute_hash) ⇒ Object
- .ensure_presence_of_pattern(ancestor_node_name) ⇒ Object
Class Method Details
.ensure_absence_of_ancestor_node(ancestor_node_name, attributes = []) ⇒ Object
23 24 25 26 |
# File 'lib/scrubyt/core/scraping/constraint_adder.rb', line 23 def self.ensure_absence_of_ancestor_node(ancestor_node_name, attributes=[]) Constraint.add_ensure_absence_of_ancestor_node(ancestor_node_name, prepare_attributes(attributes)) end |
.ensure_absence_of_attribute(attribute_hash) ⇒ Object
32 33 34 |
# File 'lib/scrubyt/core/scraping/constraint_adder.rb', line 32 def self.ensure_absence_of_attribute(attribute_hash) Constraint.add_ensure_absence_of_attribute(attribute_hash) end |
.ensure_presence_of_ancestor_node(ancestor_node_name, attributes = []) ⇒ Object
18 19 20 21 |
# File 'lib/scrubyt/core/scraping/constraint_adder.rb', line 18 def self.ensure_presence_of_ancestor_node(ancestor_node_name, attributes=[]) Constraint.add_ensure_presence_of_ancestor_node(ancestor_node_name, prepare_attributes(attributes)) end |
.ensure_presence_of_attribute(attribute_hash) ⇒ Object
28 29 30 |
# File 'lib/scrubyt/core/scraping/constraint_adder.rb', line 28 def self.ensure_presence_of_attribute(attribute_hash) Constraint.add_ensure_presence_of_attribute(attribute_hash) end |
.ensure_presence_of_pattern(ancestor_node_name) ⇒ Object
14 15 16 |
# File 'lib/scrubyt/core/scraping/constraint_adder.rb', line 14 def self.ensure_presence_of_pattern(ancestor_node_name) Constraint.add_ensure_presence_of_pattern(ancestor_node_name) end |