Sha256: 497ff2bb6befd650fa2270b69dc715c4fdb6d5ab111f1859c15fadfad7eea037

Contents?: true

Size: 622 Bytes

Versions: 1

Compression:

Stored size: 622 Bytes

Contents

# frozen_string_literal: true

module Tataru
  module Instructions
    # General checking class
    class CheckInstruction < ResourceInstruction
      def initialize(check_type)
        @check_type = check_type
      end

      def run
        resource_class = desc.resource_class
        resource = resource_class.new(memory.hash[:remote_ids][resource_name])

        if resource.send(:"#{@check_type}_complete?")
          after_complete
        else
          # repeat this instruction until its done
          memory.program_counter -= 1
        end
      end

      def after_complete(_memory); end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tataru-0.2.0 lib/tataru/instructions/check_instruction.rb