[Nitro] [PATCH] A couple of small fixes and a speedup

Darrick W darrickw at gmail.com
Sat Sep 9 18:24:08 EDT 2006


Hi,

I've got a couple of tiny patches that you may want to apply:

cacheable.patch changes Og::Cacheable to use class_methods from facets
1.4.5 instead of ClassInherit.

manageable.patch just makes sure that the class being checked actually
responds to :serializable_attributes before calling that method on it.

One other thing that may be of interest to anyone still on Facets
1.4.5.  I found a major bottleneck in OpenObject which can be fixed by
using the following code:


class OpenObject < BasicObject
  def __update__( other )
    if other.is_a?(Array)
      c = 0
      other.map do |i|
        c += 1
        if c % 2 == 1
          i.to_sym
        else
          i
        end
      end
      other = Hash[*other]
    end
    @table.merge! other
  end
end


Cheers!
Darrick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cacheable.patch
Type: application/octet-stream
Size: 22051 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20060909/032002ad/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: manageable.patch
Type: application/octet-stream
Size: 22248 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20060909/032002ad/attachment-0003.obj 


More information about the Nitro-general mailing list