[augeas-devel] [PATCH 2/2] Removed useless array conversion in 'transform'

David Lutterkort lutter at redhat.com
Mon Mar 22 22:10:18 UTC 2010


On Mon, 2010-03-22 at 14:58 -0700, David Lutterkort wrote:
> On Sun, 2010-03-21 at 11:08 +0100, Frederik Wagner wrote:
> > * lib/augeas.rb:
> >   array conversion of 'incl' and 'excl' are not needed,
> >   conversion of 'excl' never happened due to dependence on 'incl
> > ---
> >  lib/augeas.rb |    2 --
> >  1 files changed, 0 insertions(+), 2 deletions(-)
> > 
> > diff --git a/lib/augeas.rb b/lib/augeas.rb
> > index 6bbbf63..2805a26 100644
> > --- a/lib/augeas.rb
> > +++ b/lib/augeas.rb
> > @@ -100,8 +100,6 @@ class Augeas
> >          raise ArgumentError, "No lens specified" unless lens
> >          raise ArgumentError, "No files to include" unless incl
> >          name = lens.split(".")[0].sub("@", "") unless name
> > -        incl = [ incl ] unless incl.is_a?(Array)
> > -        excl = [ excl ] unless incl.is_a?(Array)
> >  
> >          xfm = "/augeas/load/#{name}/"
> >          set_internal(xfm + "lens", lens)
> 
> This isn't quite correct. What we want is to make incl and excl arrays
> if they aren't already. Later, we call each on them, with surprisig
> results if incl od excl are strings.

I just pushed a change that addresses that ...by simply using the new
set instead of set_internal for setting the incl/excl.

David





More information about the augeas-devel mailing list