Class: Ansr::Arel::Visitors::ToNoSql
- Inherits:
-
Arel::Visitors::Visitor
- Object
- Arel::Visitors::Visitor
- Ansr::Arel::Visitors::ToNoSql
- Defined in:
- lib/ansr/arel/visitors/to_no_sql.rb
Instance Attribute Summary collapse
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
-
#initialize(big_table) ⇒ ToNoSql
constructor
A new instance of ToNoSql.
- #query_builder(opts = nil) ⇒ Object
-
#visit_Arel_Nodes_SelectStatement(object, attribute) ⇒ Object
the object generated by this method will be passed to the NoSqlAdapter#execute.
Constructor Details
#initialize(big_table) ⇒ ToNoSql
Returns a new instance of ToNoSql.
5 6 7 8 |
# File 'lib/ansr/arel/visitors/to_no_sql.rb', line 5 def initialize(big_table) super() @table = big_table end |
Instance Attribute Details
#table ⇒ Object (readonly)
Returns the value of attribute table.
3 4 5 |
# File 'lib/ansr/arel/visitors/to_no_sql.rb', line 3 def table @table end |
Instance Method Details
#query_builder(opts = nil) ⇒ Object
10 11 12 |
# File 'lib/ansr/arel/visitors/to_no_sql.rb', line 10 def query_builder(opts = nil) Ansr::Arel::Visitors::QueryBuilder.new(table, opts) end |
#visit_Arel_Nodes_SelectStatement(object, attribute) ⇒ Object
the object generated by this method will be passed to the NoSqlAdapter#execute
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ansr/arel/visitors/to_no_sql.rb', line 15 def visit_Arel_Nodes_SelectStatement(object, attribute) builder = query_builder if object.with builder.visit(object.with, attribute) end object.cores.each { |x| builder.visit_Arel_Nodes_SelectCore(x, attribute) } unless object.orders.empty? object.orders.each do |x| oa = Ansr::Arel::Visitors::Order.new(attribute) builder.visit x, oa end end builder.visit(object.limit, attribute) if object.limit builder.visit(object.offset, attribute) if object.offset # not relevant builder.query_opts end |