Class: RosettAi::Config::CompileResult
- Inherits:
-
Struct
- Object
- Struct
- RosettAi::Config::CompileResult
- Defined in:
- lib/rosett_ai/config/compile_result.rb
Overview
Structured result from compiling a single scope file.
Instance Attribute Summary collapse
-
#diff ⇒ Object
readonly
Unified diff string (for simulate mode).
-
#scope ⇒ Object
readonly
The scope name (managed, user, project, local).
-
#warnings ⇒ Object
readonly
Advisory messages (version mismatch, missing env vars, etc.).
Instance Method Summary collapse
-
#action(value) ⇒ Object
One of :created, :updated, :unchanged, :skipped.
-
#changed? ⇒ Boolean
True if action is :created or :updated.
-
#initialize ⇒ CompileResult
constructor
A new instance of CompileResult.
-
#json_data(value) ⇒ Object
The compiled JSON data (before serialization).
-
#source_path(value) ⇒ Object
Path to the source YAML file.
-
#success? ⇒ Boolean
True if action is :created, :updated, or :unchanged.
-
#target_path(value) ⇒ Object
Path to the target JSON file.
Constructor Details
#initialize ⇒ CompileResult
Returns a new instance of CompileResult.
21 22 23 24 |
# File 'lib/rosett_ai/config/compile_result.rb', line 21 def initialize(**) super self.warnings ||= [] end |
Instance Attribute Details
#diff ⇒ Object (readonly)
Unified diff string (for simulate mode)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rosett_ai/config/compile_result.rb', line 17 CompileResult = Struct.new( :scope, :source_path, :target_path, :json_data, :warnings, :action, :diff ) do def initialize(**) super self.warnings ||= [] end # @return [Boolean] true if action is :created, :updated, or :unchanged def success? [:created, :updated, :unchanged].include?(action) end # @return [Boolean] true if action is :created or :updated def changed? [:created, :updated].include?(action) end end |
#scope ⇒ Object (readonly)
The scope name (managed, user, project, local)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rosett_ai/config/compile_result.rb', line 17 CompileResult = Struct.new( :scope, :source_path, :target_path, :json_data, :warnings, :action, :diff ) do def initialize(**) super self.warnings ||= [] end # @return [Boolean] true if action is :created, :updated, or :unchanged def success? [:created, :updated, :unchanged].include?(action) end # @return [Boolean] true if action is :created or :updated def changed? [:created, :updated].include?(action) end end |
#warnings ⇒ Object (readonly)
Advisory messages (version mismatch, missing env vars, etc.)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rosett_ai/config/compile_result.rb', line 17 CompileResult = Struct.new( :scope, :source_path, :target_path, :json_data, :warnings, :action, :diff ) do def initialize(**) super self.warnings ||= [] end # @return [Boolean] true if action is :created, :updated, or :unchanged def success? [:created, :updated, :unchanged].include?(action) end # @return [Boolean] true if action is :created or :updated def changed? [:created, :updated].include?(action) end end |
Instance Method Details
#action=(value) ⇒ Object
One of :created, :updated, :unchanged, :skipped
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rosett_ai/config/compile_result.rb', line 17 CompileResult = Struct.new( :scope, :source_path, :target_path, :json_data, :warnings, :action, :diff ) do def initialize(**) super self.warnings ||= [] end # @return [Boolean] true if action is :created, :updated, or :unchanged def success? [:created, :updated, :unchanged].include?(action) end # @return [Boolean] true if action is :created or :updated def changed? [:created, :updated].include?(action) end end |
#changed? ⇒ Boolean
Returns true if action is :created or :updated.
32 33 34 |
# File 'lib/rosett_ai/config/compile_result.rb', line 32 def changed? [:created, :updated].include?(action) end |
#json_data=(value) ⇒ Object
The compiled JSON data (before serialization)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rosett_ai/config/compile_result.rb', line 17 CompileResult = Struct.new( :scope, :source_path, :target_path, :json_data, :warnings, :action, :diff ) do def initialize(**) super self.warnings ||= [] end # @return [Boolean] true if action is :created, :updated, or :unchanged def success? [:created, :updated, :unchanged].include?(action) end # @return [Boolean] true if action is :created or :updated def changed? [:created, :updated].include?(action) end end |
#source_path=(value) ⇒ Object
Path to the source YAML file
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rosett_ai/config/compile_result.rb', line 17 CompileResult = Struct.new( :scope, :source_path, :target_path, :json_data, :warnings, :action, :diff ) do def initialize(**) super self.warnings ||= [] end # @return [Boolean] true if action is :created, :updated, or :unchanged def success? [:created, :updated, :unchanged].include?(action) end # @return [Boolean] true if action is :created or :updated def changed? [:created, :updated].include?(action) end end |
#success? ⇒ Boolean
Returns true if action is :created, :updated, or :unchanged.
27 28 29 |
# File 'lib/rosett_ai/config/compile_result.rb', line 27 def success? [:created, :updated, :unchanged].include?(action) end |
#target_path=(value) ⇒ Object
Path to the target JSON file
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rosett_ai/config/compile_result.rb', line 17 CompileResult = Struct.new( :scope, :source_path, :target_path, :json_data, :warnings, :action, :diff ) do def initialize(**) super self.warnings ||= [] end # @return [Boolean] true if action is :created, :updated, or :unchanged def success? [:created, :updated, :unchanged].include?(action) end # @return [Boolean] true if action is :created or :updated def changed? [:created, :updated].include?(action) end end |