lib/defmastership/definition.rb in defmastership-1.0.7 vs lib/defmastership/definition.rb in defmastership-1.0.8
- old
+ new
@@ -4,23 +4,23 @@
require 'digest'
module DefMastership
# DefMastership definition: contains all data of a definition
class Definition
- attr_reader :type, :reference, :lines, :labels, :eref, :iref, :attributes
+ attr_reader :type, :reference, :lines, :labels, :eref, :iref, :attributes, :explicit_version
def initialize(match)
@type = match[:type]
@reference = match[:reference]
@lines = []
@labels = Set.new
- labels = match[:labels]
- @labels.merge(labels.split(/\s*,\s*/).to_set) if labels
+ @labels.merge(match[:labels].split(/\s*,\s*/).to_set) if match[:labels]
@eref = Hash.new([])
@iref = []
@attributes = {}
@explicit_checksum = match[:explicit_checksum]
+ @explicit_version = match[:explicit_version]
end
def <<(new_line)
@lines << new_line
self
@@ -29,10 +29,10 @@
def value
@lines.join("\n")
end
def sha256
- Digest::SHA2.new(256).hexdigest(value).split(//).last(8).join
+ "~#{Digest::SHA2.new(256).hexdigest(value).split(//).last(8).join}"
end
def wrong_explicit_checksum
@explicit_checksum if @explicit_checksum != sha256
end