Sha256: aee1c4ffe9c84f3c0213cd10d51d0cec16b121add80c09c4da4fd9d37c078bc7
Contents?: true
Size: 996 Bytes
Versions: 3
Compression:
Stored size: 996 Bytes
Contents
require_relative 'input/input' require_relative 'output/output' require_relative 'process/process' require_relative 'support/terminal' module Vedeu class Application def self.start(options = {}) new(options).start end def initialize(options = {}) @options = options || {} end def start Terminal.open do Output.render runner { main_sequence } end end private attr_reader :options def runner if interactive? interactive { yield } else run_once { yield } end end def main_sequence Input.capture Process.evaluate Output.render end def interactive? options.fetch(:interactive) end def interactive loop { yield } rescue StopIteration end def run_once yield end def options defaults.merge!(@options) end def defaults { interactive: true } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.0.32 | lib/vedeu/application.rb |
vedeu-0.0.31 | lib/vedeu/application.rb |
vedeu-0.0.30 | lib/vedeu/application.rb |