Class: Puppet::SSL::Digest
Instance Attribute Summary collapse
-
#digest ⇒ Object
readonly
Returns the value of attribute digest.
Instance Method Summary collapse
-
#initialize(algorithm, content) ⇒ Digest
constructor
A new instance of Digest.
- #name ⇒ Object
- #to_hex ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(algorithm, content) ⇒ Digest
Returns a new instance of Digest.
4 5 6 7 |
# File 'lib/puppet/ssl/digest.rb', line 4 def initialize(algorithm, content) algorithm ||= 'SHA256' @digest = OpenSSL::Digest.new(algorithm, content) end |
Instance Attribute Details
#digest ⇒ Object (readonly)
Returns the value of attribute digest.
2 3 4 |
# File 'lib/puppet/ssl/digest.rb', line 2 def digest @digest end |
Instance Method Details
#name ⇒ Object
17 18 19 |
# File 'lib/puppet/ssl/digest.rb', line 17 def name @digest.name.upcase end |
#to_hex ⇒ Object
13 14 15 |
# File 'lib/puppet/ssl/digest.rb', line 13 def to_hex @digest.hexdigest.scan(/../).join(':').upcase end |
#to_s ⇒ Object
9 10 11 |
# File 'lib/puppet/ssl/digest.rb', line 9 def to_s "(#{name}) #{to_hex}" end |