Skip to content

Commit

Permalink
Defer evaluating ac_change unless/until needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ldss-jm committed Oct 19, 2023
1 parent 71991cf commit e737efe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions lib/marc_wrangler/record_comparer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ def initialize(rec, ex_rec, spec)

@changed = detect_change(comparable_in_fields, comparable_ex_fields)

output_static = @spec['incoming record output files'] &&
@spec['incoming record output files']['STATIC'] != 'do not output'
return unless @changed || output_static

@ac_change = detect_ac_change(ac_in_fields, ac_ex_fields)
@output_static = @spec['incoming record output files'] &&
@spec['incoming record output files']['STATIC'] != 'do not output'
end

def static?
Expand All @@ -31,7 +28,11 @@ def detect_change(in_fields, ex_fields)
end

def ac_change?
@ac_change
return @ac_change if @ac_change

return unless @changed || @output_static

@ac_change ||= detect_ac_change(ac_in_fields, ac_ex_fields)
end

def detect_ac_change(in_fields, ex_fields)
Expand Down
2 changes: 1 addition & 1 deletion lib/marc_wrangler/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module MarcWrangler
VERSION = '0.1.5.1'.freeze
VERSION = '0.1.6'.freeze
end

0 comments on commit e737efe

Please sign in to comment.