Class: Nest

Inherits:
Object
  • Object
show all
Defined in:
lib/nest.rb

Instance Method Summary collapse

Constructor Details

#initialize(ns, rc = Redic.new) ⇒ Nest

Returns a new instance of Nest.



24
25
26
27
# File 'lib/nest.rb', line 24

def initialize(ns, rc = Redic.new)
  @ns = ns.to_s
  @rc = rc
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



76
77
78
# File 'lib/nest.rb', line 76

def method_missing(m, *args)
  call(m, *args)
end

Instance Method Details

#[](key) ⇒ Object



29
30
31
# File 'lib/nest.rb', line 29

def [](key)
  Nest.new("#{@ns}:#{key}", @rc)
end

#call(command, *args) ⇒ Object



56
57
58
# File 'lib/nest.rb', line 56

def call(command, *args)
  @rc.call(command, to_s, *args)
end

#call!(command, *args) ⇒ Object



60
61
62
# File 'lib/nest.rb', line 60

def call!(command, *args)
  @rc.call!(command, to_s, *args)
end

#commitObject



68
69
70
# File 'lib/nest.rb', line 68

def commit
  @rc.commit
end

#hashObject



37
38
39
# File 'lib/nest.rb', line 37

def hash
  @ns.hash
end

#inspectObject



72
73
74
# File 'lib/nest.rb', line 72

def inspect
  @ns.inspect
end

#queue(command, *args) ⇒ Object



64
65
66
# File 'lib/nest.rb', line 64

def queue(command, *args)
  @rc.queue(command, to_s, *args)
end

#redisObject



33
34
35
# File 'lib/nest.rb', line 33

def redis
  @rc
end

#to_aryObject Also known as: to_a



41
42
43
# File 'lib/nest.rb', line 41

def to_ary
  nil
end

#to_json(*args) ⇒ Object



52
53
54
# File 'lib/nest.rb', line 52

def to_json(*args)
  @ns.to_json(*args)
end

#to_strObject Also known as: to_s



45
46
47
# File 'lib/nest.rb', line 45

def to_str
  @ns
end