Module: Redis::Strict

Includes:
NotStrict
Included in:
Bin::RubyRedisServer
Defined in:
lib/redis/strict.rb

Overview

Strict version allows the ruby-redis server to pass redis tests.

Instance Method Summary collapse

Methods included from NotStrict

#redis_pos_i

Instance Method Details

#redis_f(val, msg = 'value is not a double') ⇒ Object



53
54
55
56
# File 'lib/redis/strict.rb', line 53

def redis_f val, msg = 'value is not a double'
  raise msg+val.to_s.dump unless Numeric === val or val =~ /^[ +-]?([0-9.e-]*|inf)$/i
  super
end

#redis_i(val, msg = 'value is not an integer or out of range') ⇒ Object



58
59
60
61
# File 'lib/redis/strict.rb', line 58

def redis_i val, msg = 'value is not an integer or out of range'
  raise msg unless Integer === val or val =~ /^[ +-]?[0-9]*$/
  super
end

#redis_t(*args) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/redis/strict.rb', line 40

def redis_t *args
  val = args.pop
  msg = 'Operation against a key holding the wrong kind of value'
  unless Class === args.last
    msg = val
    val = args.pop
  end
  args.each do |klass|
    return if klass === val
  end
  raise msg
end