Thanks Sharon. I made this change so that plugins could accept args in
addition to opts:
--- lib/sequel/model/plugins.rb (revision 568)
+++ lib/sequel/model/plugins.rb (working copy)
@@ -4,8 +4,8 @@
class Model
class << self
# Loads a plugin for use with the model class
- def is(plugin, opts = {})
- plugin_module(plugin).apply(self, opts)
+ def is(plugin, *args)
+ plugin_module(plugin).apply(self, *args)
end
alias_method :is_a, :is
Here's what I have so far using your plugin code in trunk:
http://pastie.caboo.se/124351
I could use some help cleaning up the apply function and how scope is
implemented.
I'd like not to pollute the model with helper functions specific to
the plugin (position_field, position_scope, position_scope_field), or
at least make them private.
Since scope is optional, I only define position_scope and
position_scope_field if the opts[:scope] is provided, and then check
for respond_to?(:position_scope) in the rest of the code, which seems
rather messy to me.
Aman Gupta
On Dec 2, 12:35 pm, Sharon Rosner <[EMAIL PROTECTED]> wrote:
> Plugin loading is now implemented in the trunk. Each plugin is
> expected to conform to Wayne and Aman's specification, with the
> addition of an apply method that takes a model class and an options
> hash. The implementation is here:
>
> http://ruby-sequel.googlecode.com/svn/trunk/lib/sequel/model/plugins.rb
>
> best
> Sharon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" 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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---