[Nitro] Facets 1.8
transfire at gmail.com
transfire at gmail.com
Mon Jan 29 17:45:24 EST 2007
On Jan 29, 12:25 pm, "George Moschovitis"
<george.moschovi... at gmail.com> wrote:
> Dear devs,
>
> with Tom's help I have succesfully converted Nitro to use the latest
> annotations from Facets 1.8 (and cleaned up the source code a bit in the
> process).
>
> I would like to ask Tom to release my minor changes to ann_attr.rb (mainly
> the ann_attr_callback, and the removed code) and the fixes in singular.rb as
> Facets 1.8.1 so I can push my repository to the public darcs repository.
okay. almost there. I see you removed serializable_attributes from
facets ann_attr.rb. that's good b/c serialize annotation is specific
to og, but the :class annotation is general, so I was thinking of
having:
def classified_attributes
attributes.find_all do |a|
self.ann(a, :class)
end
end
also (and more important) i'm not liking the the callback.
if Module.respond_to?(:ann_attr_callback)
Module.ann_attr_callback(self, klass, args)
end
unless you see a reason it won't work, i think this would be better:
if respond_to?(:attr_callback)
attr_callback(self, args, harg)
end
Example:
irb(main):012:0> class X
irb(main):013:1> def self.attr_callback(*a); p *a; end
irb(main):014:1> end
=> nil
irb(main):015:0> class X
irb(main):016:1> attr :x, String, :doc => "hello"
irb(main):017:1> end
X
[:x]
{:class=>String, :doc=>"hello"}
=> [:x]
>From that you would just get the class via anno[:class] and instead of
defining a univeral attr_callback as:
class Module
def self.attr_ann_callback
...
it would just be
class Module
def attr_callback
...
what do you think?
T.
More information about the Nitro-general
mailing list