Class: LittleGhost::Tool::Result

Inherits:
Data
  • Object
show all
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

Instance Method Summary collapse

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

#artifactsObject (readonly)

Returns the value of attribute artifacts

Returns:

  • (Object)

    the current value of artifacts



128
129
130
# File 'lib/little_ghost/tool.rb', line 128

def artifacts
  @artifacts
end

#valueObject (readonly)

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



128
129
130
# File 'lib/little_ghost/tool.rb', line 128

def value
  @value
end