riaktor 0.0.4.1 → 0.0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/riaktor.rb CHANGED
@@ -17,7 +17,7 @@ gem "activemodel", '= 3.0.0.beta'
17
17
  require "active_model"
18
18
 
19
19
  module Riaktor
20
- VERSION = '0.0.4.1'
20
+ VERSION = '0.0.4.3'
21
21
  end
22
22
 
23
23
  require "#{File.dirname(__FILE__)}/riaktor/client"
@@ -32,8 +32,8 @@ module Riaktor
32
32
  url = []
33
33
  url << "http://#{self.config[:host]}:#{self.config[:port]}"
34
34
  url << self.config[:prefix]
35
- url << URI.escape(bucket).gsub("/", "%2F")
36
- url << URI.escape(key).gsub("/", "%2F") if key
35
+ url << URI.escape(bucket.to_s).gsub("/", "%2F")
36
+ url << URI.escape(key.to_s).gsub("/", "%2F") if key
37
37
  url.join("/")
38
38
  end
39
39
 
@@ -109,6 +109,10 @@ module Riaktor
109
109
  !@siblings.nil?
110
110
  end
111
111
 
112
+ def just_created?
113
+ @just_created == true
114
+ end
115
+
112
116
  def save(opts={})
113
117
  raise(SaveError, "cannot save with siblings present") if self.in_conflict?
114
118
  if new_record? || changed? or opts[:force] == true
@@ -128,10 +132,12 @@ module Riaktor
128
132
  when 200 then
129
133
  @links = Link.from_header(resp["headers"]["Link"])
130
134
  @vector_clock = resp["headers"]["X-Riak-Vclock"]
135
+ @just_created = true if new_record?
131
136
  @new = false
132
137
  when 300 then
133
138
  @links = Link.from_header(resp["headers"]["Link"])
134
139
  @vector_clock = resp["headers"]["X-Riak-Vclock"]
140
+ @just_created = true if new_record?
135
141
  @new = false
136
142
  vtags = resp["body"].split("\n")[1..-1]
137
143
  load_siblings_from_vtags(vtags,{"r" => op["params"]["r"]})
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.0.4.1
9
+ - 3
10
+ version: 0.0.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ben Myles
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-03-23 00:00:00 -07:00
18
+ date: 2010-03-27 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency