Sha256: 04b9f3d5d559090a8f679f1673690e414767fb8bd9268c03cba3ea05b0bc974e

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

require_relative '../repository/command_repository'
require_relative '../support/queue'
require_relative '../support/parser'

module Vedeu
  class Process
    def self.evaluate
      new.evaluate
    end

    def initialize; end

    def evaluate
      fail StopIteration if no_result?

      json = Parser.parse(result)

      Composition.enqueue(json)
    end

    private

    def no_result?
      result.nil? || result.empty? || result == :stop
    end

    def result
      @result ||= command.execute(*args) if command
    end

    def command
      @command ||= CommandRepository.by_input(input)
    end

    def input
      @input ||= Queue.dequeue
    end

    def args
      []
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.0.26 lib/vedeu/process/process.rb