On Jul 7, 5:14 pm, Jeremy Evans <[email protected]> wrote:
> On Jul 7, 2:11 pm, Phrogz <[email protected]> wrote:
>
> > Alternatively:
> > * Is there an existing, better way to do this already?
>
> Dataset#from_self, though you can't give the dataset an explicit alias
> if you do that. Modifying from_self to take an options hash and
> an :alias option would be my recommendation for how to handle this.
> I'd gladly accept a patch that did that.
Ah, my mistake. I skimmed the method names several times looking for
"bundle" or "clone" (but not that one) or "group" (but not that one)
or "parenize", but didn't see #from_self. I should have read the full
description of each method.
Which of the following implementations do you prefer:
# Option 1 - change one line from current
def from_self( aliaz=nil )
fs = {}
@opts.keys.each{|k| fs[k] = nil}
clone(fs).from( aliaz ? as(aliaz) : self )
end
# Option 2 - standalone
def from_self( aliaz=nil )
if aliaz
@db.dataset.from(as(aliaz))
else
fs = {}
@opts.keys.each{|k| fs[k] = nil}
clone(fs).from(self)
end
end
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---