cmaxvv
September 14, 2007, 7:03pm
1
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 ? This seems
a bit wrong to me for some reason.
cmaxvv
September 17, 2007, 10:15am
2
<%= this is dislayed on page %>
<% this is pure ruby hidden from page %>
<%# and this is a comment, nothing happens here %>
cmaxvv
September 17, 2007, 10:53am
3
Shai R. 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.
cmaxvv
September 17, 2007, 10:59am
4
Max W. wrote:
Shai R. 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
cmaxvv
September 17, 2007, 1:23pm
5
On Fri, 14 Sep 2007, Max W. wrote:
[…] and am unsure of how to document/comment the .rhtml files. […]
Is it best to just do everything in ? 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
cmaxvv
September 17, 2007, 2:37pm
7
Hugh S. wrote:
On Fri, 14 Sep 2007, Max W. wrote:
[…] and am unsure of how to document/comment the .rhtml files. […]
Is it best to just do everything in ? 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
That’s cool, i didn’t realise you could put entire blocks of ruby code
within <% %> - i’d been doing one per line. Thanks!
cmaxvv
September 17, 2007, 3:11pm
8
Hugh S. 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]