Class: Wallaby::ActiveRecord::ModelServiceProvider::Querier::Transformer
- Inherits:
-
Parslet::Transform
- Object
- Parslet::Transform
- Wallaby::ActiveRecord::ModelServiceProvider::Querier::Transformer
- Defined in:
- lib/adapters/wallaby/active_record/model_service_provider/querier/transformer.rb
Overview
Build up query using the results
Constant Summary collapse
- SIMPLE_OPERATORS =
:nodoc:
{ # :nodoc: ':' => :eq, ':=' => :eq, ':!' => :not_eq, ':!=' => :not_eq, ':<>' => :not_eq, ':~' => :matches, ':^' => :matches, ':$' => :matches, ':!~' => :does_not_match, ':!^' => :does_not_match, ':!$' => :does_not_match, ':>' => :gt, ':>=' => :gteq, ':<' => :lt, ':<=' => :lteq }.freeze
- SEQUENCE_OPERATORS =
:nodoc:
{ # :nodoc: ':' => :in, ':=' => :in, ':!' => :not_in, ':!=' => :not_in, ':<>' => :not_in, ':()' => :between, ':!()' => :not_between }.freeze
- SEQUENCE_JOIN_OPERATORS =
:nodoc:
{ # :nodoc: ':' => :or, ':=' => :or, ':!' => :and, ':!=' => :and, ':<>' => :and }.freeze
- BETWEEN_OPERATORS =
:nodoc:
{ # :nodoc: ':()' => true, ':!()' => true }.freeze
Class Method Summary collapse
- .execute(query_string) ⇒ Array
-
.to_origin(exp) ⇒ String
Origin expression.
- .warn(message, exp = nil) ⇒ nil
Class Method Details
.execute(query_string) ⇒ Array
106 107 108 109 |
# File 'lib/adapters/wallaby/active_record/model_service_provider/querier/transformer.rb', line 106 def execute(query_string) result = new.apply Parser.new.parse(query_string || EMPTY_STRING) result.is_a?(Array) ? result : [result] end |
.to_origin(exp) ⇒ String
Returns origin expression.
120 121 122 |
# File 'lib/adapters/wallaby/active_record/model_service_provider/querier/transformer.rb', line 120 def to_origin(exp) "'#{exp['left']}#{exp['op']}#{exp['right']}'" end |
.warn(message, exp = nil) ⇒ nil
114 115 116 |
# File 'lib/adapters/wallaby/active_record/model_service_provider/querier/transformer.rb', line 114 def warn(, exp = nil) Logger.warn , exp: to_origin(exp), sourcing: 2 end |