class ActiveInteraction::TimeFilter
@private
Public Class Methods
new(name, options = {}, &block)
click to toggle source
Calls superclass method
ActiveInteraction::Filter::new
# File lib/active_interaction/filters/time_filter.rb, line 26 def initialize(name, options = {}, &block) raise InvalidFilterError, 'format option unsupported with time zones' if options.key?(:format) && time_with_zone? super end
Public Instance Methods
database_column_type()
click to toggle source
# File lib/active_interaction/filters/time_filter.rb, line 32 def database_column_type :datetime end
Private Instance Methods
convert(value)
click to toggle source
Calls superclass method
ActiveInteraction::AbstractDateTimeFilter#convert
# File lib/active_interaction/filters/time_filter.rb, line 58 def convert(value) value = value.to_int if value.respond_to?(:to_int) if value.is_a?(Numeric) [klass.at(value), nil] else super end rescue NoMethodError # BasicObject super end
klass()
click to toggle source
Calls superclass method
ActiveInteraction::Filter#klass
# File lib/active_interaction/filters/time_filter.rb, line 42 def klass if time_with_zone? Time.zone else super end end
klasses()
click to toggle source
Calls superclass method
ActiveInteraction::AbstractDateTimeFilter#klasses
# File lib/active_interaction/filters/time_filter.rb, line 50 def klasses if time_with_zone? [Time.zone.at(0).class, Time] else super end end
time_with_zone?()
click to toggle source
# File lib/active_interaction/filters/time_filter.rb, line 38 def time_with_zone? Time.respond_to?(:zone) && !Time.zone.nil? end