bone 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/CHANGES.txt +8 -0
  2. data/bone.gemspec +1 -1
  3. data/lib/bone.rb +17 -1
  4. metadata +2 -2
@@ -1,5 +1,13 @@
1
1
  BONE, CHANGES
2
2
 
3
+ #### 0.2.3 (2010-01-09) ###############################
4
+
5
+ * CHANGE: Bone.get and Bone[] no longer raise an exception for unknown keys
6
+ * CHANGE: Bone.set and Bone[]= no longer raise an exception for unknown keys
7
+ * ADDED: Bone.get! to raise exception for unknown keys.
8
+ * ADDED: Bone.set! to raise exception for unknown keys.
9
+
10
+
3
11
  #### 0.2.2 (2010-01-08) ###############################
4
12
 
5
13
  * FIXED: Bone.keys returns Array instead of String
@@ -1,7 +1,7 @@
1
1
  @spec = Gem::Specification.new do |s|
2
2
  s.name = "bone"
3
3
  s.rubyforge_project = 'bone'
4
- s.version = "0.2.2"
4
+ s.version = "0.2.3"
5
5
  s.summary = "Get Bones"
6
6
  s.description = s.summary
7
7
  s.author = "Delano Mandelbaum"
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  module Bone
9
9
  extend self
10
- VERSION = "0.2.2"
10
+ VERSION = "0.2.3"
11
11
  APIVERSION = 'v1'.freeze
12
12
 
13
13
  class Problem < RuntimeError; end
@@ -30,12 +30,28 @@ module Bone
30
30
  SOURCE = (ENV['BONE_SOURCE'] || "localhost:6043").freeze
31
31
  TOKEN = ENV['BONE_TOKEN'].freeze
32
32
 
33
+ # Get a key from the boned server. Same as `get!`
34
+ # but does not raise an exception for an unknown key.
33
35
  def get(key, opts={})
36
+ get! key, opts
37
+ rescue Bone::Problem
38
+ nil
39
+ end
40
+
41
+ # Get a key from the boned server. Raises an exception
42
+ # for an unknown key.
43
+ def get!(key, opts={})
34
44
  token = opts[:token] || ENV['BONE_TOKEN'] || TOKEN
35
45
  request(:get, token, key) # returns the response body
36
46
  end
37
47
 
38
48
  def set(key, value, opts={})
49
+ set! key, value, opts
50
+ rescue Bone::Problem
51
+ nil
52
+ end
53
+
54
+ def set!(key, value, opts={})
39
55
  token = opts[:token] || ENV['BONE_TOKEN'] || TOKEN
40
56
  opts[:value] = value
41
57
  request(:set, token, key, opts)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-08 00:00:00 -05:00
12
+ date: 2010-01-10 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency