Class: Fraggle::Snap

Inherits:
Object show all
Defined in:
lib/fraggle/snap.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, c, rev = nil) ⇒ Snap

Returns a new instance of Snap.



9
10
11
12
13
# File 'lib/fraggle/snap.rb', line 9

def initialize(id, c, rev=nil)
  @id  = id
  @c   = c
  @rev = rev
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &blk) ⇒ Object



38
39
40
# File 'lib/fraggle/snap.rb', line 38

def method_missing(*args, &blk)
  @c.__send__(*args, &blk)
end

Instance Attribute Details

#cObject (readonly)

Returns the value of attribute c.



7
8
9
# File 'lib/fraggle/snap.rb', line 7

def c
  @c
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/fraggle/snap.rb', line 7

def id
  @id
end

#revObject (readonly)

Returns the value of attribute rev.



7
8
9
# File 'lib/fraggle/snap.rb', line 7

def rev
  @rev
end

Instance Method Details

#get(path, &blk) ⇒ Object



15
16
17
# File 'lib/fraggle/snap.rb', line 15

def get(path, &blk)
  @c.get(@id, path, &blk)
end

#getdir(path, offset = 0, limit = 0, &blk) ⇒ Object



27
28
29
# File 'lib/fraggle/snap.rb', line 27

def getdir(path, offset=0, limit=0, &blk)
  @c.getdir(@id, path, offset, limit, &blk)
end

#snap(&blk) ⇒ Object



31
32
33
34
35
36
# File 'lib/fraggle/snap.rb', line 31

def snap(&blk)
  @c.snap do |res|
    sn = Snap.new(res.id, @c, res.rev)
    blk.call(sn)
  end
end

#stat(path, &blk) ⇒ Object



23
24
25
# File 'lib/fraggle/snap.rb', line 23

def stat(path, &blk)
  @c.stat(@id, path, &blk)
end

#walk(glob, &blk) ⇒ Object



19
20
21
# File 'lib/fraggle/snap.rb', line 19

def walk(glob, &blk)
  @c.walk(@id, glob, &blk)
end