Class: Rigor::SigGen::WriteResult
- Inherits:
-
Object
- Object
- Rigor::SigGen::WriteResult
- Defined in:
- lib/rigor/sig_gen/write_result.rb
Overview
Per-source-file outcome of a rigor sig-gen --write run.
The writer reports back what it did so the renderer (and the CLI's exit-status logic) can summarise actions and surface user-authored-skip decisions without having to re-parse the produced files.
source_path— original.rbfile.target_path—.rbsfile the writer was responsible for (nilwhen the source path falls outside the project signature tree, in which caseactionis:skipped_outside_sig_root).action— one of:created/:updated/:noop/:skipped_outside_sig_root.applied— the MethodCandidates that actually landed on disk.skipped— the MethodCandidates the writer declined (e.g. tighter-return without--overwrite). Each entry pairs the candidate with a skip reason keyword (:user_authored).
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#applied ⇒ Object
readonly
Returns the value of attribute applied.
-
#skipped ⇒ Object
readonly
Returns the value of attribute skipped.
-
#source_path ⇒ Object
readonly
Returns the value of attribute source_path.
-
#target_path ⇒ Object
readonly
Returns the value of attribute target_path.
Instance Method Summary collapse
-
#initialize(source_path:, target_path:, action:, applied: [], skipped: []) ⇒ WriteResult
constructor
A new instance of WriteResult.
- #to_h ⇒ Object
Constructor Details
#initialize(source_path:, target_path:, action:, applied: [], skipped: []) ⇒ WriteResult
Returns a new instance of WriteResult.
20 21 22 23 24 25 26 27 |
# File 'lib/rigor/sig_gen/write_result.rb', line 20 def initialize(source_path:, target_path:, action:, applied: [], skipped: []) @source_path = source_path @target_path = target_path @action = action @applied = applied.freeze @skipped = skipped.freeze freeze end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
18 19 20 |
# File 'lib/rigor/sig_gen/write_result.rb', line 18 def action @action end |
#applied ⇒ Object (readonly)
Returns the value of attribute applied.
18 19 20 |
# File 'lib/rigor/sig_gen/write_result.rb', line 18 def applied @applied end |
#skipped ⇒ Object (readonly)
Returns the value of attribute skipped.
18 19 20 |
# File 'lib/rigor/sig_gen/write_result.rb', line 18 def skipped @skipped end |
#source_path ⇒ Object (readonly)
Returns the value of attribute source_path.
18 19 20 |
# File 'lib/rigor/sig_gen/write_result.rb', line 18 def source_path @source_path end |
#target_path ⇒ Object (readonly)
Returns the value of attribute target_path.
18 19 20 |
# File 'lib/rigor/sig_gen/write_result.rb', line 18 def target_path @target_path end |
Instance Method Details
#to_h ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/rigor/sig_gen/write_result.rb', line 29 def to_h { source: source_path, target: target_path&.to_s, action: action.to_s, applied: applied.map(&:to_h), skipped: skipped.map { |c, reason| c.to_h.merge(write_skip_reason: reason.to_s) } } end |