Class: ConditionsFu::ConditionsArray

Inherits:
Array
  • Object
show all
Defined in:
lib/conditions_fu/builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ConditionsArray

Returns a new instance of ConditionsArray.



5
6
7
# File 'lib/conditions_fu/builder.rb', line 5

def initialize(*args)
  super
end

Instance Method Details

#create_active_record_conditionsObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/conditions_fu/builder.rb', line 9

def create_active_record_conditions
  conditions = ""
  self.each do |condition|
    if self.last == condition
      conditions << "#{condition[0]}"
    else
      conditions << "#{condition[0]} #{condition[2]} "
    end
  end
  [conditions.strip, self.map{|i| i[1]}].flatten
end