Sha256: a754bb57020d575874af1557fa2af4e8e7516bdb0a723cf92c32b26f1261a476

Contents?: true

Size: 548 Bytes

Versions: 2

Compression:

Stored size: 548 Bytes

Contents

# frozen_string_literal: true

module Granite
  module Form
    module Types
      module ActiveSupport
        class TimeZone < Float
          private

          def typecast(value)
            case value
            when ::ActiveSupport::TimeZone
              value
            when ::TZInfo::Timezone
              ::ActiveSupport::TimeZone[value.name]
            when ::String, ::Numeric, ::ActiveSupport::Duration
              ::ActiveSupport::TimeZone[super || value]
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
granite-form-0.6.1 lib/granite/form/types/active_support/time_zone.rb
granite-form-0.6.0 lib/granite/form/types/active_support/time_zone.rb