rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: Daniel N <has.sox@gmail.com>
To: rack-devel@googlegroups.com
Subject: Re: Use a different name instead of 'call' ?
Date: Sat, 20 Feb 2010 16:01:57 +1100	[thread overview]
Message-ID: <2fff50391002192101x18f84aafh426d8eabd8fbc14b@mail.gmail.com> (raw)
In-Reply-To: <c7c67973-6214-4f54-bb8e-095056361db9@k11g2000vbe.googlegroups.com>

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

Hi,

The strength of rack is that it's a common standard.  A rack application
must respond to call, and receive an argument, the environment.

If you were to create middleware with a different entry method, how would
the calling middleware know what to call?  The standard says to call the
"call" method, thus, all middleware know how to execute all middleware /
applications.  By changing the names of methods, you're not not able to call
it.

If your application absolutely _must_ implement a call method, then you'll
need to wrap it.  If a module you're including defines a call method, then
you'll need to divorce that from the actual middleware container.

Your middleware can be a very simple wrapper around your object, but in
order to work the interface for rack must be preserved.

HTH
Daniel

On 20 February 2010 09:22, Guoliang Cao <gcao99@gmail.com> wrote:

> Hi,
>
> I'm relatively new here. Please forgive me if this has been asked
> before.
>
> I'm wondering if it is possible to name 'call' differently in my
> middleware. Because 'call' is a relatively popular name and in case it
> is already used in one of the modules I included, I have to create a
> wrapper for my middleware. It'll be perfect if I can do something like
> this:
>
> class MyMiddleware
>  def rack_call_method
>     :my_rack_call
>  end
>
>  def my_rack_call env
>     # my middleware implementation goes here
>  end
> end
>
> Thank you.
>
> Cao
>

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

  reply	other threads:[~2010-02-20  5:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-19 22:22 Use a different name instead of 'call' ? Guoliang Cao
2010-02-20  5:01 ` Daniel N [this message]
2010-02-21 15:50   ` Guoliang Cao

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=2fff50391002192101x18f84aafh426d8eabd8fbc14b@mail.gmail.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).