I would like to redirect large chunks of text to a specific
resource (file, stderr, etc). I thought that the code below
would do my job:
def |>(s)
myputs %Q|#{s}
end
def <|
>
end
Well, that doesn’t work for a number of reasons. For starters it
should basically quote “\nend\n…”. And I don’t think <| and |> are
valid names…
Yes. Actually I am aware of why this produces syntax errors. It was
easier to paste it as an idea instead of describing what I was looking
for.
eRuby basically replace “%>anything<%” with “puts
‘anything’”. Everything else is left as is.
Does something like CPP exist in Ruby? I.e. a way to define some symbols
that expand during the code. In a C-ish way:
#define <% myputs %Q| #define %> |
Depends on what you’re trying to do. If you just want chucks of text
in your code:
puts <<EOF
something here…
EOF
I produce chunks of text in various places in my program and I like an
interface such as the one eruby uses. Currently, the closest I can get is:
myputs %Q|
...
...
>
It would be nice if I could substitute the above with 2 distinct Object’s
operators.
If you want eRuby behaviour… Why not just use eRuby? I’ve used it as
templating for emails.
I don’t want to increase my project’s depedencies.
Regards,
···
On Sat, Mar 13, 2004 at 11:40:54PM +0900, Thomas Fini Hansen wrote:
On Sat, Mar 13, 2004 at 09:21:27PM +0900, Elias Athanasopoulos wrote:
–
University of Athens I bet the human brain
Physics Department is a kludge --Marvin Minsky