Hi, +1, Minor comment: This leaves some: "if !" which we could as well replace with unless which is easier to read, the reverse is also true (ie unless ! => if).
Why not then extend your regex to cover those cases? On Wed, 2009-10-14 at 14:46 -0700, Markus Roberts wrote: > > Signed-off-by: Markus Roberts <[email protected]> > --- > lib/puppet/parser/ast/definition.rb | 2 +- > lib/puppet/util/settings/setting.rb | 2 +- > lib/puppet/util/storage.rb | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/lib/puppet/parser/ast/definition.rb > b/lib/puppet/parser/ast/definition.rb > index 5d6f078..4112e5c 100644 > --- a/lib/puppet/parser/ast/definition.rb > +++ b/lib/puppet/parser/ast/definition.rb > @@ -176,7 +176,7 @@ class Puppet::Parser::AST::Definition < > Puppet::Parser::AST::Branch > self.arguments.each { |arg, default| > arg = arg.to_sym > unless args.include?(arg) > - if defined? default and ! default.nil? > + if ! default.nil? > default = default.safeevaluate scope > args[arg] = default > #Puppet.debug "Got default %s for %s in %s" % > diff --git a/lib/puppet/util/settings/setting.rb > b/lib/puppet/util/settings/setting.rb > index 5e529c0..292ea28 100644 > --- a/lib/puppet/util/settings/setting.rb > +++ b/lib/puppet/util/settings/setting.rb > @@ -62,7 +62,7 @@ class Puppet::Util::Settings::Setting > end > > def set? > - if defined? @value and ! @value.nil? > + if ! @value.nil? > return true > else > return false > diff --git a/lib/puppet/util/storage.rb b/lib/puppet/util/storage.rb > index 01c4111..f1528d9 100644 > --- a/lib/puppet/util/storage.rb > +++ b/lib/puppet/util/storage.rb > @@ -55,7 +55,7 @@ class Puppet::Util::Storage > Puppet.settings.use(:main) unless > FileTest.directory?(Puppet[:statedir]) > > unless File.exists?(Puppet[:statefile]) > - unless defined? @@state and ! @@state.nil? > + unless ! @@state.nil? > self.init > end > return -- Brice Figureau Follow the latest Puppet Community evolutions on www.planetpuppet.org! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" 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/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---
