Sha256: 7b0dfa0c48d3a07332b90e9346f11a254c522cd82012f47ba8d97bf9a76777b1

Contents?: true

Size: 532 Bytes

Versions: 1

Compression:

Stored size: 532 Bytes

Contents

require 'resque'
require 'resque/server'

module Resque

  module Tabber

    Version = '0.0.1'

    class << self

      def add_tab(tab_name, tab_url)
        sinatra_url = url(tab_name)

        # Add a tab
        ::Resque::Server.class_eval %{
          get "#{sinatra_url}" do
            redirect "#{tab_url}"
          end
        }

        # Create the action to redirect
        Resque::Server.tabs << tab_name
      end

      private

      def url(name)
        '/' + name.to_s.downcase
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resque-tabber-0.0.1 lib/resque-tabber.rb