| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Some of the nodes classes are missing either one or many of the common comparison methods #hash, #eql? and #==.
This makes comparision and working with the ast sometimes painful, as equality or operations likes array differences (which uses a hash behind the scene) produces unexpected results.
A test has been added that ensures that every descendants of Node:
* have all 3 methods
* that all 3 methods were defined from the same class
* that the class defining all 3 is also a descendant of Node, to avoid the default ones that rely on identity only
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
People are often trying to use ARel nodes inside ActiveRecord, and when
they do so, lots of things can break, because ActiveRecord relies on
Array#uniq and sometimes hash key equality to handle values that end up
in wheres, havings, etc. By implementing equality for all the nodes, we
should hopefully be able to prevent any nodes (even nodes containing
other nodes) from failing an equality check they should otherwise pass,
and alleviate many of these errors.
Fixes #130
|
| |
|
|
This is useful for dynamically created predicates e.g:
expr1 = table.create_false
expr2 = table.create_false
expr1 = create_a_predicate() if some_condition
expr2 = create_another_predicate() if some_other_condition
table.where(expr1.and(expr2))
|