Class: Time
- 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
101 102 103 104 |
# File 'lib/ripple/core_ext/casting.rb', line 101 def self.ripple_cast(value) return nil if value.blank? value.respond_to?(:to_time) && value.to_time or raise Ripple::PropertyTypeMismatch.new(self, value) end |
Instance Method Details
#as_json(options = {}) ⇒ Object
97 98 99 |
# File 'lib/ripple/core_ext/casting.rb', line 97 def as_json(={}) self.utc.send(Ripple.date_format) end |
#to_ripple_index(type) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/ripple/core_ext/indexes.rb', line 26 def to_ripple_index(type) case type when 'bin' utc.send(Ripple.date_format) when 'int' # Use millisecond-precision (utc.to_f * 1000).round end end |