class ArelConverter::Translator::Options

Constants

LINE_LENGTH

Public Instance Methods

hash_to_arel(lhs, rhs) click to toggle source
# File lib/arel_converter/translators/options.rb, line 41
def hash_to_arel(lhs, rhs)
  key = lhs.sub(':','')
  case key
  when 'conditions'
    key = 'where'
  when 'include'
    key = 'includes'
  when 'none', 'reverse_order'
    return key
  end
  rhs = rhs.gsub(/\A\[(.*)\]\z/, '\1').gsub(/\A\{(.*)\}\z/, '\1')
  "#{key}(#{rhs})"
end
logger() click to toggle source
# File lib/arel_converter/translators/options.rb, line 7
def logger
  @logger ||= setup_logger
end
process_call(exp) click to toggle source
Calls superclass method
# File lib/arel_converter/translators/options.rb, line 33
def process_call(exp)
  if valid_arel_method?(exp[1])
    @depth ||= 0
    @depth += 1 if @depth == 0
  end
  super
end

Private Instance Methods

valid_arel_method?(m) click to toggle source
# File lib/arel_converter/translators/options.rb, line 143
def valid_arel_method?(m)
  %w[bind
    create_with
    eager_load
    extending
    from
    group
    having
    includes
    joins
    limit
    lock
    none
    offset
    order
    preload
    readonly
    references
    reorder
    reverse_order
    select
    distinct
    uniq
    where].include?(m.to_s)
end