Class: CodeToQuery::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/code_to_query/compiler.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Compiler

Returns a new instance of Compiler.



13
14
15
# File 'lib/code_to_query/compiler.rb', line 13

def initialize(config)
  @config = config
end

Instance Method Details

#compile(intent, current_user: nil) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/code_to_query/compiler.rb', line 17

def compile(intent, current_user: nil)
  intent_with_policy = apply_policy_predicates(intent, current_user)
  if use_arel?
    compile_with_arel(intent_with_policy)
  else
    compile_with_string_building(intent_with_policy)
  end
end