Sha256: c1d2a7e8a711cf8e2de5b397ace1267bb430bdb2c00e58a4e7ca219be587b6f0

Contents?: true

Size: 390 Bytes

Versions: 6

Compression:

Stored size: 390 Bytes

Contents

module Pubsubstub
  class Application
    def initialize(*)
      @publish = PublishAction.new
      @stream = StreamAction.new
    end

    def self.call(env)
      @instance ||= new
      @instance.call(env)
    end

    def call(env)
      request = Rack::Request.new(env)
      if request.get?
        @stream.call(env)
      else
        @publish.call(env)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pubsubstub-0.3.0 lib/pubsubstub/application.rb
pubsubstub-0.2.2 lib/pubsubstub/application.rb
pubsubstub-0.2.1 lib/pubsubstub/application.rb
pubsubstub-0.2.0 lib/pubsubstub/application.rb
pubsubstub-0.1.3 lib/pubsubstub/application.rb
pubsubstub-0.1.2 lib/pubsubstub/application.rb