Class: ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter
- Inherits:
-
Type::Value
- Object
- ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/attribute_methods/time_zone_conversion.rb
Overview
:nodoc:
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.new(subtype) ⇒ Object
9 10 11 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/attribute_methods/time_zone_conversion.rb', line 9 def self.new(subtype) self === subtype ? subtype : super end |
Instance Method Details
#cast(value) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/attribute_methods/time_zone_conversion.rb', line 17 def cast(value) return if value.nil? if value.is_a?(Hash) set_time_zone_without_conversion(super) elsif value.is_a?(Range) Range.new(user_input_in_time_zone(value.begin), user_input_in_time_zone(value.end), value.exclude_end?) elsif value.respond_to?(:in_time_zone) begin super(user_input_in_time_zone(value)) || super rescue ArgumentError nil end elsif value.respond_to?(:infinite?) && value.infinite? value else map_avoiding_infinite_recursion(super) { |v| cast(v) } end end |
#deserialize(value) ⇒ Object
13 14 15 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/attribute_methods/time_zone_conversion.rb', line 13 def deserialize(value) convert_time_to_time_zone(super) end |