"Hola, Tanneritos"
The delimiter to use when joining Array values before creating a new digest hash. The default is ":".
Returns the current debug status (true or false)
# File lib/gibbler.rb, line 268 def debug?; @debug != false; end
Sends input to Digest::SHA1.hexdigest. If another digest class has been specified, that class will be used instead. If Gibbler.secret is set, str will be prepended with the value.
If input is an Array, it will be flattened and joined.
See: digest_type
# File lib/gibbler.rb, line 279 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) dig = dig.to_i(16).to_s(Gibbler.default_base) if 16 != Gibbler.default_base dig end
# File lib/gibbler.rb, line 289 def self.gibbler_debug(*args) return unless Gibbler.debug? p args end
Raises an exception. The correct usage is to include a Gibbler::Object:
# File lib/gibbler.rb, line 299 def self.included(obj) raise "You probably want to include Gibbler::Complex or Gibbler::Object" end
Creates a digest from the given input. See Gibbler.digest.
If only one argument is given and it's a digest, this will simply create an instance of that digest. In other words, it won't calculate a new digest based on that input.
# File lib/gibbler.rb, line 231 def initialize *input if input.size == 1 && Gibbler::Digest::InstanceMethods === input.first super input.first else input.collect!(&:to_s) super Gibbler.digest(input) || '' end end
Generated with the Darkfish Rdoc Generator 2.