Sha256: 735e74a2e5cc1f456783475ae002e7302b1d65eab69f8c2d59266ef9b434708e

Contents?: true

Size: 353 Bytes

Versions: 4

Compression:

Stored size: 353 Bytes

Contents

class Kredis::Types::Scalar < Kredis::Types::Proxying
  proxying :set, :get, :exists?, :del

  attr_accessor :typed, :default

  def value=(value)
    set type_to_string(value)
  end

  def value
    string_to_type(get, typed) || default
  end

  def to_s
    get || default&.to_s
  end

  def assigned?
    exists?
  end

  def clear
    del
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kredis-0.2.3 lib/kredis/types/scalar.rb
kredis-0.2.2 lib/kredis/types/scalar.rb
kredis-0.2.1 lib/kredis/types/scalar.rb
kredis-0.2.0 lib/kredis/types/scalar.rb