Sha256: 115e6d9763bcec561a53a2444e7132b762eb511df9703fd024f82d8d1b3560fd

Contents?: true

Size: 645 Bytes

Versions: 1

Compression:

Stored size: 645 Bytes

Contents

require_relative "middleware"
require_relative "command"
require_relative "router"

module MVCLI
  class App

    def initialize
      @middleware = Middleware.new
      @middleware << Router.new
    end

    def call(command)
      @middleware.call command
    end

    def root
      self.class.root or fail "Invalid App: undefined application root directory"
    end

    class << self
      attr_accessor :root
    end

    def main(argv = ARGV.dup, input = $stdin, output = $stdout, log = $stderr, env = ENV.dup)
      call Command.new(argv, input, output, log, env)
    end

    def self.main(*args)
      new.main *args
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mvcli-0.0.1 lib/mvcli/app.rb