Just trying to understand your "tweak".
def call_tag_parameter_with_default_content(the_tag, attributes,
default_content, overriding_content_proc)
...
@separator = attributes.key?(:separator) ? [attributes
[:separator]] : ""
out = send(the_tag, attributes, { :default => d })
@separator = ""
So I see if I have a key called separator in my attributes hash, if I
do I store the value in an Array, otherwise I return empty String,
result stored in instance var @separator for later use...
Then I call send to actually render the tag <do ...>
and after the call I always reset the instance variable
call_tag_parameter is called at some point after doing send(...). PS:
What does send really do here?
def call_tag_parameter(the_tag, attributes, parameters,
caller_parameters, param_name)
...
if @separator.kind_of?(Array)
@separator = @separator[0]
override_and_call_tag(the_tag, attributes, parameters,
overriding_attributes, overriding_parameters)
else
@separator + override_and_call_tag(the_tag, attributes,
parameters, overriding_attributes, overriding_parameters)
end
So if separator is an array I take out the first and only element
(clever!), then override the tag (hmmm?)
Then I guess this will result in another call to this same method
call_tag_parameter, where the separator will now be a non-empty
string, fx "," and will be prepended before the call resulting in
rendering the content?
But how does all this control that I only get commas between non-empty
content and not a comma too many either before or after rendering all
default params???
Guess I still have a long way before becoming Hobo-fu master! ;)
your
I really wish these essential DRYML functions would be better
explained... to allow for such extensions! I hope your tweak makes it
into next release :)
-K
On Sep 23, 11:24 pm, Brett Nelson <[email protected]> wrote:
> Here is tweak that enables:
>
> <def tag="commas">
> <do param="default" separator=","/>
> </def>
>
> http://github.com/blizz/hobo/commit/48e1cf5394a3412f73d199bf42c990136...
>
> Now that I've done it am thinking it might have been better done with
> a parameter rather than attribute as it allows more flexibility, but
> I'll leave that exercise up to the next hobohacker to give it a try.
>
> Brett
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---