Sha256: 1d2531a599a0db009b4ba6a5b22f31e031a8dd150b2a8e634a598cef1e6f9fe5

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 Bytes

Contents

module Jjjaaa
  class Middleware
    def initialize(app)
      @app = app
    end

    def call(env)
      job = fork do
        exec "afplay #{jjjaaa}"
      end

      Process.detach job

      status, headers, response = @app.call(env)

      [status, headers, response]
    end

    private

    def path
      Pathname.new File.expand_path File.dirname(__FILE__)
    end

    def lib
      path.parent
    end

    def base
      lib.parent
    end

    def sounds
      base.join "sounds"
    end

    def jjjaaa
      sounds.join "jjjaaa#{(0..12).to_a.sample}.mp3"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jjjaaa-1.1.0 lib/jjjaaa/middleware.rb