gibbler 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/CHANGES.txt +6 -0
  2. data/README.rdoc +13 -0
  3. data/gibbler.gemspec +1 -1
  4. data/lib/gibbler.rb +10 -2
  5. metadata +2 -2
data/CHANGES.txt CHANGED
@@ -1,5 +1,11 @@
1
1
  GIBBLER, CHANGES
2
2
 
3
+ * TODO: Global salt
4
+
5
+ #### 0.8.3 (2010-05-04) ###############################
6
+
7
+ * ADDED: Support for global secret (Gibbler.secret) which is prepended to all digests.
8
+
3
9
  #### 0.8.2 (2010-04-29) ###############################
4
10
 
5
11
  * FIXED: test exception for "String has list of attic vars" tryouts when bundled with my other libraries.
data/README.rdoc CHANGED
@@ -135,6 +135,19 @@ In Jruby, you can grab the digest types from the openssl library.
135
135
  :kimmy.gibbler.to_i # => 472384540402900668368761869477227308873774630879
136
136
 
137
137
 
138
+ == Example 6 -- Global secret
139
+
140
+ Gibbler can prepend all digest inputs with a global secret. You can set this once per project to ensure your project's digests are unique.
141
+
142
+ require 'gibbler'
143
+
144
+ :kimmy.gibbler # => 52be7494a602d85ff5d8a8ab4ffe7f1b171587df
145
+
146
+ Gibbler.secret = "sUp0r5ekRu7"
147
+
148
+ :kimmy.gibbler # => 6c5f5aff4d809cec7e7da091214a35a2698489f8
149
+
150
+
138
151
  == Supported Classes
139
152
 
140
153
  Gibbler methods are available only to the classes which explicitly include them (see RDocs[http://delano.github.com/gibbler] for details on which classes are supported by default). You can also extend custom objects:
data/gibbler.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  @spec = Gem::Specification.new do |s|
2
2
  s.name = "gibbler"
3
3
  s.rubyforge_project = "gibbler"
4
- s.version = "0.8.2"
4
+ s.version = "0.8.3"
5
5
  s.summary = "Gibbler: Git-like hashes for Ruby objects"
6
6
  s.description = s.summary
7
7
  s.author = "Delano Mandelbaum"
data/lib/gibbler.rb CHANGED
@@ -15,14 +15,18 @@ require 'digest/sha1'
15
15
  # "Hola, Tanneritos"
16
16
  #
17
17
  module Gibbler
18
- VERSION = "0.8.2"
18
+ VERSION = "0.8.3"
19
+
20
+ @secret = nil
21
+ class << self
22
+ attr_accessor :secret
23
+ end
19
24
 
20
25
  require 'gibbler/mixins'
21
26
 
22
27
  class Error < RuntimeError
23
28
  def initialize(obj); @obj = obj; end
24
29
  end
25
-
26
30
  end
27
31
 
28
32
 
@@ -224,9 +228,13 @@ module Gibbler
224
228
 
225
229
  # Sends +str+ to Digest::SHA1.hexdigest. If another digest class
226
230
  # has been specified, that class will be used instead.
231
+ # If Gibbler.secret is set, +str+ will be prepended with the
232
+ # value.
233
+ #
227
234
  # See: digest_type
228
235
  def self.digest(str, digest_type=nil)
229
236
  digest_type ||= @@gibbler_digest_type
237
+ str = [Gibbler.secret, str].join(':') unless Gibbler.secret.nil?
230
238
  digest_type.hexdigest str
231
239
  end
232
240
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gibbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.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-04-29 00:00:00 -04:00
12
+ date: 2010-05-04 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency