Sha256: 538cf33c942be4eb4c0f78e176f74dd449eb8a7bc08d5005d68ec15c3f4de42c

Contents?: true

Size: 698 Bytes

Versions: 3

Compression:

Stored size: 698 Bytes

Contents

module Vedeu
  class Application
    class << self
      def start(options = {})
        new(options).main_sequence
      end
    end

    def initialize(options = {})
      @options = options
    end

    def main_sequence
      Terminal.open(options) do
        initial_state

        event_loop
      end
    ensure
      Terminal.close
    end

    private

    attr_reader :options

    def event_loop
      interfaces.event_loop
    end

    def initial_state
      interfaces.initial_state
    end

    def interfaces
      @interfaces ||= Interfaces.defined || Interfaces.default
    end

    def options
      defaults.merge!(@options)
    end

    def defaults
      {}
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vedeu-0.0.8 lib/vedeu/application.rb
vedeu-0.0.7 lib/vedeu/application.rb
vedeu-0.0.6 lib/vedeu/application.rb