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
715 716 717 718 719 720 721 722 723 |
# File 'lib/wice_grid.rb', line 715 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
704 705 706 707 708 709 710 711 712 |
# File 'lib/wice_grid.rb', line 704 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:
699 700 701 |
# File 'lib/wice_grid.rb', line 699 def special_value(str) #:nodoc: str =~ /^\s*(not\s+)?null\s*$/i end |