Sha256: 7db204266b164cf06bee57335b2ed0a59b0508f2134a99d7554da744452e63a0

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 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?

      parsed_data = Parser.parse(result)

      Composition.enqueue(parsed_data)
    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.27 lib/vedeu/process/process.rb