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



513
514
515
516
517
518
519
520
521
# File 'lib/wice_grid.rb', line 513

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



502
503
504
505
506
507
508
509
510
# File 'lib/wice_grid.rb', line 502

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:



497
498
499
# File 'lib/wice_grid.rb', line 497

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