[Nitro] Facets 1.4.2

TRANS transfire at gmail.com
Wed Jun 21 18:53:21 EDT 2006


On 6/21/06, Bryan Soto <bryan.a.soto at gmail.com> wrote:
> lib/facets/core/module/basename.rb:20
>
> def basename
> +  if self.name and not self.name.empty?
> -   if self.name
>
> It seems that mod.name is returning "" (empty string), not nil. Please
> make as elegant as you wish. :)

Yea, but self.name returns "" too, so maybe basnema should do the
same. If you look at waht it returns when fixed, like you show, then
the basename is something like:

  Module_0xb7cd02cc

And that's pretty useless. So I think I'll make paramix skip anonymous
modules. Obviously if they don;t have a name, no one's planning to
reference them manually either. Lets try this:

 def basename
    if name and not name.empty?
      name.gsub(/^.*::/, '')
    end
 end

And in paramix.rb theres two places essentially the same/ Change to:

        mixin_parameters[mod] = params
        if mod.basename?
          define_method( mod.basename ) do |key|
            if params.key?(key)
              params[key]
            else
              super if defined?( super )
            end
          end
        end

See any problems with that. Could you test that?

Thanks,
T.



More information about the Nitro-general mailing list