fraggle 1.0.0.pre.2 → 1.0.0.pre.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -36,6 +36,8 @@
36
36
  e.path # => "/foo"
37
37
  e.value # => "bar"
38
38
  e.rev # => 123
39
+ e.set? # => true
40
+ e.del? # => false
39
41
 
40
42
  do_something_with(e)
41
43
 
@@ -46,7 +48,7 @@
46
48
  end
47
49
 
48
50
  ## Setting a key (this will trigger the watch above)
49
- req = c.set(0, "/foo", "zomg!") do |e|
51
+ req = c.set("/foo", "zomg!", 0) do |e|
50
52
  # Success!
51
53
  end.error do |e|
52
54
  if e.mismatch?
@@ -59,12 +61,16 @@
59
61
  # Knowning when a command is done is useful in some cases.
60
62
  # Use the `done` callback for those situations.
61
63
  ents = []
62
- req = c.getdir("/test") do |e|
64
+ c.getdir("/test") do |e|
63
65
  ents << e
64
66
  end.done do
65
67
  p ents
66
68
  end
67
69
 
70
+ c.get("/nothere") do |e|
71
+ e.missing? # => true
72
+ end
73
+
68
74
  end
69
75
 
70
76
  ## Consistency
@@ -26,7 +26,6 @@ module Fraggle
26
26
  attr_reader :last_received, :addr
27
27
 
28
28
  def initialize(addr)
29
- p [:init, addr]
30
29
  @addr, @cb = addr, {}
31
30
  end
32
31
 
@@ -5,6 +5,8 @@ module Fraggle
5
5
 
6
6
  VALID = 1
7
7
  DONE = 2
8
+ SET = 4
9
+ DEL = 8
8
10
 
9
11
  attr_accessor :disconnected
10
12
 
@@ -18,6 +20,20 @@ module Fraggle
18
20
  (flags & DONE) > 0
19
21
  end
20
22
 
23
+ def set?
24
+ return false if !flags
25
+ (flags & SET) > 0
26
+ end
27
+
28
+ def set?
29
+ return false if !flags
30
+ (flags & DEL) > 0
31
+ end
32
+
33
+ def missing?
34
+ rev == 0
35
+ end
36
+
21
37
  def ok?
22
38
  err_code.nil?
23
39
  end
@@ -1,3 +1,3 @@
1
1
  module Fraggle
2
- VERSION = "1.0.0.pre.2"
2
+ VERSION = "1.0.0.pre.3"
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fraggle
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1923831949
4
+ hash: 1923831951
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
10
  - pre
11
- - 2
12
- version: 1.0.0.pre.2
11
+ - 3
12
+ version: 1.0.0.pre.3
13
13
  platform: ruby
14
14
  authors:
15
15
  - Blake Mizerany
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-04-25 00:00:00 -05:00
20
+ date: 2011-04-26 00:00:00 -07:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency