Max Williams
2007-Sep-14 17:03 UTC
Suggestions for commenting/documenting view (.rhtml) files?
I''m writing up my RoR degree project (the project is RoR, not the degree!), and am unsure of how to document/comment the .rhtml files. Has anyone else done this before or have any recommendations/suggestion? Is it best to just do everything in <!-- html comments --> ? This seems a bit wrong to me for some reason. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hugh Sasse
2007-Sep-14 17:36 UTC
Re: Suggestions for commenting/documenting view (.rhtml) files?
On Fri, 14 Sep 2007, Max Williams wrote:> [...] and am unsure of how to document/comment the .rhtml files. [...] > > Is it best to just do everything in <!-- html comments --> ? This seems > a bit wrong to me for some reason.You can comment the ruby code inside them thusly: <% # This next method is only used in this file, and doesn''t # belong anywhere else def do_amazing_magic(spells={}) SufficientlyAdvancedTechnology.execute(spells) end %> HTH Hugh --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Shai Rosenfeld
2007-Sep-17 08:15 UTC
Re: Suggestions for commenting/documenting view (.rhtml) fil
<%= this is dislayed on page %> <% this is pure ruby hidden from page %> <%# and this is a comment, nothing happens here %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Max Williams
2007-Sep-17 08:53 UTC
Re: Suggestions for commenting/documenting view (.rhtml) fil
Shai Rosenfeld wrote:> <%= this is dislayed on page %> > <% this is pure ruby hidden from page %> > > <%# and this is a comment, nothing happens here %>ah...doesn''t the ruby interpreter have a problem with these lines then? I thought it would say "unknown method or attribute ''this''" or something. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Shai Rosenfeld
2007-Sep-17 08:59 UTC
Re: Suggestions for commenting/documenting view (.rhtml) fil
Max Williams wrote:> Shai Rosenfeld wrote: >> <%= this is dislayed on page %> >> <% this is pure ruby hidden from page %> >> >> <%# and this is a comment, nothing happens here %> > > ah...doesn''t the ruby interpreter have a problem with these lines then? > I thought it would say "unknown method or attribute ''this''" or > something.just as in a ruby file, the ''#'' means a comment until the end of the line. this will give you an error: <%# will raise a parsing error (the opening erb <% and matching closing one arent on the same line %> but, you could use comments in erb like so <% # all of these # are # lines # but the one below me is not a = 13 %> <%# this is comment as well %> <% =begin all of the blah blah here is one big multiple line comment, but after the =end it is plain erb =end a = 13 %> enjoy -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Max Williams
2007-Sep-17 09:01 UTC
Re: Suggestions for commenting/documenting view (.rhtml) fil
> <% > # all of these > # are > # lines > # but the one below me is not > a = 13 > %>this is great - thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Max Williams
2007-Sep-17 12:37 UTC
Re: Suggestions for commenting/documenting view (.rhtml) fil
Hugh Sasse wrote:> On Fri, 14 Sep 2007, Max Williams wrote: > >> [...] and am unsure of how to document/comment the .rhtml files. [...] >> >> Is it best to just do everything in <!-- html comments --> ? This seems >> a bit wrong to me for some reason. > > You can comment the ruby code inside them thusly: > > <% > # This next method is only used in this file, and doesn''t > # belong anywhere else > def do_amazing_magic(spells={}) > SufficientlyAdvancedTechnology.execute(spells) > end > %> > > HTH > HughThat''s cool, i didn''t realise you could put entire blocks of ruby code within <% %> - i''d been doing one per line. Thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Chris Bloom
2007-Sep-17 13:11 UTC
Re: Suggestions for commenting/documenting view (.rhtml) fil
Hugh Sasse wrote:> <% > # This next method is only used in this file, and doesn''t > # belong anywhere else > def do_amazing_magic(spells={}) > SufficientlyAdvancedTechnology.execute(spells) > end > %>Care to share your SufficientlyAdvancedTechnology class? [grin] -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---