Class: VK::G

Inherits:
O
  • Object
show all
Defined in:
lib/valkey/objects.rb

Instance Attribute Summary

Attributes inherited from O

#key

Instance Method Summary collapse

Methods inherited from O

#initialize

Constructor Details

This class inherits a constructor from VK::O

Instance Method Details

#&(k) ⇒ Object



199
200
201
# File 'lib/valkey/objects.rb', line 199

def & k
  VK.redis.call("SINTER", key, k.key)
end

#<<(i) ⇒ Object



193
194
195
# File 'lib/valkey/objects.rb', line 193

def << i
  VK.redis.call("SADD", key, i)
end

#[](k) ⇒ Object



205
206
207
208
209
# File 'lib/valkey/objects.rb', line 205

def [] k
  r, h = Regexp.new(k), {}
  VK.redis.call("SMEMBERS", key).each { |e| if m = r.match(e); h[e] = m; end; }
  return h
end

#lengthObject



190
191
192
# File 'lib/valkey/objects.rb', line 190

def length
  VK.redis.call("SCARD", key)
end

#rm(i) ⇒ Object



196
197
198
# File 'lib/valkey/objects.rb', line 196

def rm i
  VK.redis.call("SREM", key, i)
end

#value(&b) ⇒ Object



187
188
189
# File 'lib/valkey/objects.rb', line 187

def value &b
  VK.redis.call("SMEMBERS", key).each_with_index { |e, i| b.call(i, e) }
end

#|(k) ⇒ Object



202
203
204
# File 'lib/valkey/objects.rb', line 202

def | k
  VK.redis.call("SUNION", key, k.key)
end