Module: Wice::GridTools

Defined in:
lib/wice_grid.rb

Overview

routines called from WiceGridExtentionToActiveRecordColumn (ActiveRecord::ConnectionAdapters::Column) or FilterConditionsGenerator classes

Class Method Summary collapse

Class Method Details

.params_2_date(par) ⇒ Object

create a Date instance out of parameters


575
576
577
578
579
580
581
582
583
# File 'lib/wice_grid.rb', line 575

def params_2_date(par)   #:nodoc:
  return nil if par.blank?
  params =  [par[:year], par[:month], par[:day]].collect{|v| v.blank? ? nil : v.to_i}
  begin
    Date.civil(*params)
  rescue ArgumentError, TypeError
    nil
  end
end

.params_2_datetime(par) ⇒ Object

create a Time instance out of parameters


564
565
566
567
568
569
570
571
572
# File 'lib/wice_grid.rb', line 564

def params_2_datetime(par)   #:nodoc:
  return nil if par.blank?
  params =  [par[:year], par[:month], par[:day], par[:hour], par[:minute]].collect{|v| v.blank? ? nil : v.to_i}
  begin
    Time.local(*params)
  rescue ArgumentError, TypeError
    nil
  end
end

.special_value(str) ⇒ Object

:nodoc:


559
560
561
# File 'lib/wice_grid.rb', line 559

def special_value(str)   #:nodoc:
  str =~ /^\s*(not\s+)?null\s*$/i
end