Class: Date
- Defined in:
- lib/ripple/core_ext/casting.rb,
lib/ripple/core_ext/indexes.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.ripple_cast(value) ⇒ Object
113 114 115 116 |
# File 'lib/ripple/core_ext/casting.rb', line 113 def self.ripple_cast(value) return nil if value.blank? value.respond_to?(:to_date) && value.to_date or raise Ripple::PropertyTypeMismatch.new(self, value) end |
Instance Method Details
#as_json(options = {}) ⇒ Object
109 110 111 |
# File 'lib/ripple/core_ext/casting.rb', line 109 def as_json(={}) self.to_s(Ripple.date_format) end |
#to_ripple_index(type) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/ripple/core_ext/indexes.rb', line 39 def to_ripple_index(type) case type when 'bin' to_s(Ripple.date_format) when 'int' to_time(:utc).to_ripple_index(type) end end |