Sha256: d962e5a4f0c8586a4fc686c618609b74c7a55631492c0c1c4e4a1260fade2749
Contents?: true
Size: 611 Bytes
Versions: 3
Compression:
Stored size: 611 Bytes
Contents
# frozen_string_literal: true module Kredis::DefaultValues extend ActiveSupport::Concern prepended do attr_writer :default proxying :watch, :unwatch, :exists? def default case @default when Proc then @default.call when Symbol then send(@default) else @default end end private def set_default raise NotImplementedError, "Kredis type #{self.class} needs to define #set_default" end end def initialize(...) super if default watch do set_default unless exists? unwatch end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kredis-1.7.0 | lib/kredis/default_values.rb |
kredis-1.6.1 | lib/kredis/default_values.rb |
kredis-1.6.0 | lib/kredis/default_values.rb |