Sha256: b7bd80702926b78c29a073bc5d6eb3c07f4f7de6850bcc9512386eccf6b6d74a

Contents?: true

Size: 793 Bytes

Versions: 2

Compression:

Stored size: 793 Bytes

Contents

module Inesita
  class Server
    def initialize(*args, &block)
      server = server(*args, &block)

      @rack = Rack::Builder.new do
        run server
      end

      Opal.append_path 'app'
      Inesita.assets_code = assets_code
    end

    def call(*args)
      @rack.call(*args)
    end

    def assets_code(path = 'application')
      @server.javascript_include_tag(path)
    end

    def server(*args, &block)
      @server = if block_given?
                  Opal::SimpleServer.new(*args, &block)
                else
                  Opal::SimpleServer.new(*args) do |server|
                    server.main = ::Inesita::Config::SERVER_MAIN
                    server.index_path = ::Inesita::Config::SERVER_INDEX_PATH
                  end
                end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inesita-1.0.pre.9 lib/inesita/server.rb
inesita-1.0.pre.8 lib/inesita/server.rb