rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: John Mayor <pedrosampaio80@gmail.com>
To: rack-devel@googlegroups.com
Subject: call rack middleware inside method
Date: Wed, 22 May 2013 02:18:31 -0700 (PDT)	[thread overview]
Message-ID: <4ecc391d-1918-48b9-8640-0645c55da695@googlegroups.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]

I'm really new to rack dev and have a stupid question.
I have a sinatra app and I need to use a rack middleware. Here's my code.

@config.ru
require 'rubygems'
require 'bundler'
require './app'
run App


@app.rb
...
class App < Sinatra::Base

use Rack::MyClass, {:param1 => "one", :param2 => "two"} do|output|
...
end

end

this works fine. the problem is that I need to call the rack middleware 
inside a method. something like this.

class App < Sinatra::Base

def my_method

use Rack::MyClass, {:param1 => "one", :param2 => "two"} do|output|
...
end

end

end


but unfortunately this does not work. can anyone give some help with this?
why it doesn't work and how can I find a solution for this?

thanks.

-- 

--- 
You received this message because you are subscribed to the Google Groups "Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



[-- Attachment #2: Type: text/html, Size: 1586 bytes --]

                 reply	other threads:[~2013-05-22 13:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://groups.google.com/group/rack-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ecc391d-1918-48b9-8640-0645c55da695@googlegroups.com \
    --to=rack-devel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).