Module: Wice::GridTools
- Defined in:
- lib/wice_grid.rb
Overview
routines called from WiceGridExtentionToActiveRecordColumn (ActiveRecord::ConnectionAdapters::Column) or ConditionsGeneratorColumn classes
Class Method Summary collapse
-
.params_2_date(par) ⇒ Object
create a Date instance out of parameters.
-
.params_2_datetime(par) ⇒ Object
create a Time instance out of parameters.
-
.special_value(str) ⇒ Object
:nodoc:.
Class Method Details
.params_2_date(par) ⇒ Object
create a Date instance out of parameters
600 601 602 603 604 605 606 607 608 |
# File 'lib/wice_grid.rb', line 600 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
589 590 591 592 593 594 595 596 597 |
# File 'lib/wice_grid.rb', line 589 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:
584 585 586 |
# File 'lib/wice_grid.rb', line 584 def special_value(str) #:nodoc: str =~ /^\s*(not\s+)?null\s*$/i end |