class RailsAgnosticModels::ArelTranslator::Where

Attributes

conditions[RW]

Public Class Methods

new(conditions) click to toggle source
# File lib/rails_agnostic_models/arel_translator/where.rb, line 7
def initialize(conditions)
  @conditions = conditions
end

Public Instance Methods

translate!() click to toggle source
# File lib/rails_agnostic_models/arel_translator/where.rb, line 11
def translate!
  case self.conditions
  when Hash then return wrap_where hash_without_braches(self.conditions)
  when String then return wrap_where "\"#{self.conditions}\""
  when Array then return wrap_where array_without_brackets(self.conditions)
  end
end

Private Instance Methods

wrap_where(str) click to toggle source
# File lib/rails_agnostic_models/arel_translator/where.rb, line 21
def wrap_where(str)
  "where(#{str})"
end