Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Gibbler.digest now returns nil for an empty Array

  • Loading branch information...
commit 0133d513c574bb76e3b1bbedb6b43e091679965c 1 parent 9da8329
@delano authored
Showing with 3 additions and 1 deletion.
  1. +1 −0  CHANGES.txt
  2. +2 −1  lib/gibbler.rb
View
1  CHANGES.txt
@@ -6,6 +6,7 @@ GIBBLER, CHANGES
* CHANGE: Gibbler is now a class which supplies the default standalone usage
* CHANGE: Ruby object mixins must now be explicitly loaded via "require 'gibbler/mixins'"
* CHANGE: Removed Gibbler.enable_debug/disable_debug
+* CHANGE: Gibbler.digest now returns nil for an empty Array
* ADDED: Gibbler.delimiter
View
3  lib/gibbler.rb
@@ -233,7 +233,7 @@ def initialize *input
super input.first
else
input.collect!(&:to_s)
- super Gibbler.digest(input)
+ super Gibbler.digest(input) || ''
end
end
def digest_type
@@ -278,6 +278,7 @@ def debug?; @debug != false; end
# See: digest_type
def self.digest(input, digest_type=nil)
input = input.flatten.collect(&:to_s).join(delimiter) if ::Array === input
+ return if input.empty?
digest_type ||= @digest_type
input = [Gibbler.secret, input].join(delimiter) unless Gibbler.secret.nil?
dig = digest_type.hexdigest(input)
Please sign in to comment.
Something went wrong with that request. Please try again.