Module: SupportMethod
- Included in:
- ActiveRecord::Base
- Defined in:
- lib/helper/support_method.rb
Instance Method Summary collapse
- #compare(arg1, arg2) ⇒ Object
- #group_result_set(result_set) ⇒ Object
- #level_check(value) ⇒ Object
- #presence_check(value) ⇒ Object
- #total_calc(result_group, field_set) ⇒ Object
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| x.parent_id ? x.parent_id.to_i : 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 |
#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 |