[Nitro] [Fwd: Accessing Element attributes]

George Moschovitis george.moschovitis at gmail.com
Thu Sep 13 14:06:39 EDT 2007


> This feels like Nitro:
>
> #   <div style="color: #{attribute :color}">

thanks :)
-g.


>
>
> George Moschovitis wrote:
> > Ok,
> >
> > I added the requested helper. It works like this:
> >
> > #
> > # To make the Element render method  more elegant, you can use
> > # the attr (or attribute helper). You can replace:
> > #
> > #   <div style="color: \#{#{@color}}">
> > #
> > # with
> > #   <div style="color: #{attr :color}">
> > #
> > # or
> >
> >
> > what do you think?
> >
> > regards,
> > George.
> >
> >
> > On 9/13/07, Robert Mela <rmela at rcn.com> wrote:
> >
> >> Saw this in raw/lib/raw/compiler/filter/elements/element.rb
> >>
> >> # class Box < Raw::Element
> >> #   def render
> >> #      %{
> >> #      <div style="color: \#{#{@color}}">
> >> #        #{content}
> >> #      </div>
> >> #      }
> >> #   end
> >>
> >> Wouldn't it be neater to include an attributes accessor on Element, so that
> >>
> >> def render
> >>
> >>   %{
> >>  *      <div style="color #{attrs[:color]}" >
> >>  *      </div>
> >>     }
> >> end
> >>
> >> or better yet...
> >>
> >>     <div style="color #{attribute_color}">
> >>
> >> _______________________________________________
> >> Nitro-general mailing list
> >> Nitro-general at rubyforge.org
> >> http://rubyforge.org/mailman/listinfo/nitro-general
> >>
> >>
> >>
> >
> >
> >
>
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>
>


-- 
http://www.me.gr
http://phidz.com
http://blog.gmosx.com
http://cull.gr
http://www.joy.gr
http://nitroproject.org


More information about the Nitro-general mailing list