Forum: Ruby on Rails Ruby on Rails and WURFL?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Joakim W. (Guest)
on 2006-01-09 23:50
Hi!

I'm a newcommer to Ruby and Rails. I've just got the environment done on
my Mac OS X machine and I am eager to start to learn more!

It seems as such a great plattform for doing webapplications.

I have a specific task I would like to acomplish but being a newbie with
Rails and Ruby  am not sure where to start.


What I want to do is to create a mobile site that is very goood at
detecting which device is used for accessing the web application and
then adjust the pages accroding to the devices capabilities.

Fortunately WURFL (http://wurfl.sourceforge.net/) is excellent at
identifying the various devices. For the Java world there is a tag
library (WALL - http://wurfl.sourceforge.net/java/index.php) that
implements a JSP tag library on top of WURFL - this makes it very easy
to develop web applications that behave cleverly with the different
devices out there. It handles WAP phones, XHTML browser and more.

The WURFL project has sometools and examples in Ruby

- http://wurfl.sourceforge.net/ruby/index.php.

My problems is that as a newbie to both Ruby and Rails i do not know
where to start? Is there something similar to JSP TAG libs? If not, can
you ecommend better approaches?

What I would like to do is to get the same ease-of-programming as if
using the WALL JSP taglibs in a Java environmet.

Could anyone here help me plot a course for how to go about this?

Cheers,
joakim
Ã?kersberga
Sweden
Jan P. (Guest)
on 2006-01-10 01:02
(Received via mailing list)
Hi, joakim,

java tag libraries - as you'll know - are shortcuts to classes that
render markup. If I define e.g. a tag named myTag and initialise it in a
tld-File with it's reference to the class my.namespace.MyTag which
renders something like
<ul>
  <li>my list</li>
</ul>

then a simple reference like <mytl:myTag> will get the output of the
rendering class and replace my directive with the rendered markup (here
html but might as well be wml, xml et. al.), right?

IMHO (being a n00b myself) the rails equivalent to functionality like
this are helpers (and components). In helpers you'll define methods that
render html and may be placed in your templates. Things aren't very
different. The learning curve for tld-Development is definitly steeper
than developing helpers in rails. My approach to your problem therefore
would be:

1. Researching if there are any native ruby libraries that provide
functionality like wurfl
2. Researching what the wurfl project already provides for ruby
3. Rebuilding the WALL tld in rails helpers (probably quite a task): Is
WALL open source? Then you would start at the tld-File, introspecting
the Rendering-Classes that are referenced in the tld and build
equivalent helpers in rails.

As a first step you might make yourself familiar with the rails
rendering kit. Keywords are Templates, Partials, Helpers, Components

YMMV
Jan
Joakim W. (Guest)
on 2006-01-11 21:21
Jan,

Thanks for the very helpful reply. I'll get going with this and are very
much looking forward to learn more about Rails and Ruby!

Seems like an excellent community this!

Cheers,
Joakim
This topic is locked and can not be replied to.