rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Use a different name instead of 'call' ?
@ 2010-02-19 22:22 Guoliang Cao
  2010-02-20  5:01 ` Daniel N
  0 siblings, 1 reply; 3+ messages in thread
From: Guoliang Cao @ 2010-02-19 22:22 UTC (permalink / raw)
  To: Rack Development

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Use a different name instead of 'call' ?
  2010-02-19 22:22 Use a different name instead of 'call' ? Guoliang Cao
@ 2010-02-20  5:01 ` Daniel N
  2010-02-21 15:50   ` Guoliang Cao
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel N @ 2010-02-20  5:01 UTC (permalink / raw)
  To: rack-devel

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Use a different name instead of 'call' ?
  2010-02-20  5:01 ` Daniel N
@ 2010-02-21 15:50   ` Guoliang Cao
  0 siblings, 0 replies; 3+ messages in thread
From: Guoliang Cao @ 2010-02-21 15:50 UTC (permalink / raw)
  To: Rack Development

Thank you fro the clear explanation.

- Cao

On Feb 20, 12:01 am, Daniel N <has....@gmail.com> wrote:
> 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 <gca...116@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
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-21 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-19 22:22 Use a different name instead of 'call' ? Guoliang Cao
2010-02-20  5:01 ` Daniel N
2010-02-21 15:50   ` Guoliang Cao

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).