Class: Mantra::Transform::Replace
- Inherits:
-
Mantra::Transform
- Object
- Mantra::Transform
- Mantra::Transform::Replace
- Defined in:
- lib/mantra/transform/replace.rb
Instance Attribute Summary collapse
-
#manifest ⇒ Object
Returns the value of attribute manifest.
Instance Method Summary collapse
Methods inherited from Mantra::Transform
description, #ensure_yml_file_exist, input, inputs, #merge_tool, #previous_transform, #raise_error_if_no_source_manifest, #run, #source_manifest, #target_manifest, #validate_inputs
Methods included from Helpers::ObjectWithType
Instance Attribute Details
#manifest ⇒ Object
Returns the value of attribute manifest.
5 6 7 |
# File 'lib/mantra/transform/replace.rb', line 5 def manifest @manifest end |
Instance Method Details
#perform ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/mantra/transform/replace.rb', line 14 def perform @manifest = previous_transform.manifest # value_manifest_element = Mantra::Manifest::Element.create(self.value).content scope = @manifest.fetch(self.scope) scope.each do |s| s.content = self.value end end |
#raise_if_no_source_manifest ⇒ Object
24 25 26 27 28 |
# File 'lib/mantra/transform/replace.rb', line 24 def raise_if_no_source_manifest if self.source.nil? || !File.exist?(self.source) raise Manifest::FileNotFoundError.new("Source manifest does not exist: #{self.source.inspect}") end end |