Sha256: 426f3739dbfea8f89159e03d2843b0f5a314050de1218b1c3965de3d58a0a1b8
Contents?: true
Size: 746 Bytes
Versions: 3
Compression:
Stored size: 746 Bytes
Contents
# frozen_string_literal: true class Kredis::Types::Scalar < Kredis::Types::Proxying prepend Kredis::DefaultValues proxying :set, :get, :exists?, :del, :expire, :expireat attr_accessor :typed, :expires_in def value=(value) set type_to_string(value, typed), ex: expires_in end def value value_after_casting = string_to_type(get, typed) if value_after_casting.nil? default else value_after_casting end end def to_s get || default&.to_s end def assigned? exists? end def clear del end def expire_in(seconds) expire seconds.to_i end def expire_at(datetime) expireat datetime.to_i end private def set_default self.value = default end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kredis-1.7.0 | lib/kredis/types/scalar.rb |
kredis-1.6.1 | lib/kredis/types/scalar.rb |
kredis-1.6.0 | lib/kredis/types/scalar.rb |