gibbler 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGES.txt +4 -0
  2. data/gibbler.gemspec +1 -1
  3. data/lib/gibbler.rb +9 -4
  4. metadata +2 -2
data/CHANGES.txt CHANGED
@@ -1,5 +1,9 @@
1
1
  GIBBLER, CHANGES
2
2
 
3
+ #### 0.7.7 (2010-03-29) ###############################
4
+
5
+ * ADDED: Gibbler::Digest#shorten
6
+
3
7
  #### 0.7.6 (2010-03-18) ###############################
4
8
 
5
9
  * FIXED: The previous fix missed the case where gibbler_fields was null
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.7.6"
4
+ s.version = "0.7.7"
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,7 +15,7 @@ require 'digest/sha1'
15
15
  # "Hola, Tanneritos"
16
16
  #
17
17
  module Gibbler
18
- VERSION = "0.7.6"
18
+ VERSION = "0.7.7"
19
19
 
20
20
  require 'gibbler/mixins'
21
21
 
@@ -37,6 +37,11 @@ class Gibbler::Digest < String
37
37
  self.class.new self.to_i(16).to_s(36)
38
38
  end
39
39
 
40
+ # Shorten the digest to the given (optional) length.
41
+ def shorten(len=20)
42
+ self[0..len-1]
43
+ end
44
+
40
45
  # Returns the first 8 characters of itself (the digest).
41
46
  #
42
47
  # e.g.
@@ -45,7 +50,7 @@ class Gibbler::Digest < String
45
50
  # "kimmy".gibbler.short # => c8027100
46
51
  #
47
52
  def short
48
- self[0..7]
53
+ shorten(8)
49
54
  end
50
55
 
51
56
  # Returns the first 6 characters of itself (the digest).
@@ -56,7 +61,7 @@ class Gibbler::Digest < String
56
61
  # "kimmy".gibbler.tiny # => c80271
57
62
  #
58
63
  def shorter
59
- self[0..5]
64
+ shorten(6)
60
65
  end
61
66
 
62
67
  # Returns the first 4 characters of itself (the digest).
@@ -67,7 +72,7 @@ class Gibbler::Digest < String
67
72
  # "kimmy".gibbler.tiny # => c802
68
73
  #
69
74
  def tiny
70
- self[0..3]
75
+ shorten(4)
71
76
  end
72
77
 
73
78
  # Returns true when +ali+ matches +self+
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.7.6
4
+ version: 0.7.7
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-03-18 00:00:00 -04:00
12
+ date: 2010-03-29 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency