Sha256: efb71efea976290f1c361f12d71f5c22b75d4e5760856f7cd7282afe4ec2c1f6

Contents?: true

Size: 943 Bytes

Versions: 1

Compression:

Stored size: 943 Bytes

Contents

Active Record Arel DepthFirst Visitor
=====================================

This gem re-introduces Arel code that was removed from Rails 6.1: https://github.com/rails/rails/pull/36492 . The code existed in the arel gem from 4.0.0 to 9.0.0, and the rails gem from 4.0.0 to 6.0.0. 

It provides a DepthFirst visitor for Arel that allows you to traverse the Arel AST, 
e.g. for visualizations.

Installation
------------

Include this gem into your Gemfile:

```ruby
gem 'activerecord-arel_depth_first'
```

Example
-------

This visitor makes the Arel AST enumerable, so you can do a depth-first 
iteration over it:

``` ruby
User.some_arbitrary_scope.arel.ast.each do |node|
  case node
  when Arel::Table
    # do something for table nodes
  when Arel::Nodes::Equality
    # do something for equality nodes
  else 
    # and so on ...
  end
end
```

## License

activerecord-arel_depth_first is released under the [MIT License](MIT-LICENSE).

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-arel_depth_first-1.0.1 README.md