Module: RedisHash::Default

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/redis_hash/concerns/default.rb

Instance Method Summary collapse

Instance Method Details

#default(field = nil) ⇒ Object



51
52
53
# File 'lib/redis_hash/concerns/default.rb', line 51

def default(field = nil)
  to_default(field, allow_nil_field: false)
end

#default=(value) ⇒ Object



39
40
41
42
# File 'lib/redis_hash/concerns/default.rb', line 39

def default=(value)
  @default = value
  @default_proc = nil
end

#default_proc=(value) ⇒ Object



44
45
46
47
48
49
# File 'lib/redis_hash/concerns/default.rb', line 44

def default_proc=(value)
  validate_proc(value) unless value.nil?

  @default = nil
  @default_proc = value
end