Module: SupportMethod

Included in:
ActiveRecord::Base
Defined in:
lib/helper/support_method.rb

Instance Method Summary collapse

Instance Method Details

#compare(arg1, arg2) ⇒ Object



19
20
21
# File 'lib/helper/support_method.rb', line 19

def compare(arg1,arg2)
  arg1 > arg2
end

#group_result_set(result_set) ⇒ Object



3
4
5
# File 'lib/helper/support_method.rb', line 3

def group_result_set(result_set)
  result_set.group_by{|x| nil_check(x.parent_id) }
end

#level_check(value) ⇒ Object



15
16
17
# File 'lib/helper/support_method.rb', line 15

def level_check(value)
  value == 0
end

#nil_check(value) ⇒ Object



23
24
25
# File 'lib/helper/support_method.rb', line 23

def nil_check(value)
  value ? value.to_i : value
end

#presence_check(value) ⇒ Object



11
12
13
# File 'lib/helper/support_method.rb', line 11

def presence_check(value)
  value.blank?
end

#total_calc(result_group, field_set) ⇒ Object



7
8
9
# File 'lib/helper/support_method.rb', line 7

def total_calc(result_group,field_set)
  result_group.sum{|x| x[field_set].to_f}
end