Sha256: 19818a0c7cd99bc39de996e29936a9842ace878f5c2ff7e9333821ad88674be8
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
require_relative 'input/input' require_relative 'output/output' require_relative 'process/process' require_relative 'support/terminal' module Vedeu class Application # :nocov: 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 # :nocov: end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.0.34 | lib/vedeu/application.rb |
vedeu-0.0.33 | lib/vedeu/application.rb |