Class: LittleGhost::Tool::Result
- Inherits:
-
Data
- Object
- Data
- LittleGhost::Tool::Result
- Defined in:
- lib/little_ghost/tool.rb,
lib/little_ghost/tool.rb
Overview
Returns a Ruby value together with files or media produced by a Tool. Tools without artifacts should return their Ruby value directly.
Instance Attribute Summary collapse
-
#artifacts ⇒ Object
readonly
Returns the value of attribute artifacts.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value:, artifacts: []) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(value:, artifacts: []) ⇒ Result
Returns a new instance of Result.
129 130 131 132 133 134 135 136 |
# File 'lib/little_ghost/tool.rb', line 129 def initialize(value:, artifacts: []) values = Array(artifacts) unless values.all? { |artifact| artifact.is_a?(Artifact) } raise ArgumentError, "artifacts must contain only LittleGhost::Artifact values" end super(value:, artifacts: values.dup.freeze) end |
Instance Attribute Details
#artifacts ⇒ Object (readonly)
Returns the value of attribute artifacts
128 129 130 |
# File 'lib/little_ghost/tool.rb', line 128 def artifacts @artifacts end |
#value ⇒ Object (readonly)
Returns the value of attribute value
128 129 130 |
# File 'lib/little_ghost/tool.rb', line 128 def value @value end |