Class: Metanorma::Release::ContentHashChangeDetector
- Inherits:
-
Object
- Object
- Metanorma::Release::ContentHashChangeDetector
- Includes:
- ChangeDetector
- Defined in:
- lib/metanorma/release/change_detector.rb
Instance Method Summary collapse
- #detect(publication, tag, force: false) ⇒ Object
-
#initialize(previous_releases:) ⇒ ContentHashChangeDetector
constructor
A new instance of ContentHashChangeDetector.
Constructor Details
#initialize(previous_releases:) ⇒ ContentHashChangeDetector
Returns a new instance of ContentHashChangeDetector.
11 12 13 |
# File 'lib/metanorma/release/change_detector.rb', line 11 def initialize(previous_releases:) @previous_releases = previous_releases end |
Instance Method Details
#detect(publication, tag, force: false) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/metanorma/release/change_detector.rb', line 15 def detect(publication, tag, force: false) current = publication.content_hash previous = @previous_releases[tag.to_s] changed = force || previous.nil? || !current.eql?(previous) ChangeResult.new(changed?: changed, current_hash: current, previous_hash: previous) end |