summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-07-09 18:05:04 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-09 18:05:04 -0700
commit9ee56f2e67be973da49b1d3f21de1bf87de35e6f (patch)
treeddab8c01509f47664c52c8a6b165bb5a974f138f /lib/puppet/util
parent051bd98751d9d4bc97f93f66723d9b7a00c0cfb4 (diff)
downloadpuppet-9ee56f2e67be973da49b1d3f21de1bf87de35e6f.tar.gz
puppet-9ee56f2e67be973da49b1d3f21de1bf87de35e6f.tar.xz
puppet-9ee56f2e67be973da49b1d3f21de1bf87de35e6f.zip
Code smell: Inconsistent indentation and related formatting issues
* Replaced 163 occurances of defined\? +([@a-zA-Z_.0-9?=]+) with defined?(\1) This makes detecting subsequent patterns easier. 3 Examples: The code: if ! defined? @parse_config becomes: if ! defined?(@parse_config) The code: return @option_parser if defined? @option_parser becomes: return @option_parser if defined?(@option_parser) The code: if defined? @local and @local becomes: if defined?(@local) and @local * Eliminate trailing spaces. Replaced 428 occurances of ^(.*?) +$ with \1 1 file was skipped. test/ral/providers/host/parsed.rb because 0 * Replace leading tabs with an appropriate number of spaces. Replaced 306 occurances of ^(\t+)(.*) with Tabs are not consistently expanded in all environments. * Don't arbitrarily wrap on sprintf (%) operator. Replaced 143 occurances of (.*['"] *%) +(.*) with Splitting the line does nothing to aid clarity and hinders further refactorings. 3 Examples: The code: raise Puppet::Error, "Cannot create %s: basedir %s is a file" % [dir, File.join(path)] becomes: raise Puppet::Error, "Cannot create %s: basedir %s is a file" % [dir, File.join(path)] The code: Puppet.err "Will not start without authorization file %s" % Puppet[:authconfig] becomes: Puppet.err "Will not start without authorization file %s" % Puppet[:authconfig] The code: $stderr.puts "Could not find host for PID %s with status %s" % [pid, $?.exitstatus] becomes: $stderr.puts "Could not find host for PID %s with status %s" % [pid, $?.exitstatus] * Don't break short arrays/parameter list in two. Replaced 228 occurances of (.*) +(.*) with 3 Examples: The code: puts @format.wrap(type.provider(prov).doc, :indent => 4, :scrub => true) becomes: puts @format.wrap(type.provider(prov).doc, :indent => 4, :scrub => true) The code: assert(FileTest.exists?(daily), "Did not make daily graph for %s" % type) becomes: assert(FileTest.exists?(daily), "Did not make daily graph for %s" % type) The code: assert(prov.target_object(:first).read !~ /^notdisk/, "Did not remove thing from disk") becomes: assert(prov.target_object(:first).read !~ /^notdisk/, "Did not remove thing from disk") * If arguments must wrap, treat them all equally Replaced 510 occurances of lines ending in things like ...(foo, or ...(bar(1,3), with \1 \2 3 Examples: The code: midscope.to_hash(false), becomes: assert_equal( The code: botscope.to_hash(true), becomes: # bottomscope, then checking that we see the right stuff. The code: :path => link, becomes: * Replaced 4516 occurances of ^( *)(.*) with The present code base is supposed to use four-space indentation. In some places we failed to maintain that standard. These should be fixed regardless of the 2 vs. 4 space question. 15 Examples: The code: def run_comp(cmd) puts cmd results = [] old_sync = $stdout.sync $stdout.sync = true line = [] begin open("| #{cmd}", "r") do |f| until f.eof? do c = f.getc becomes: def run_comp(cmd) puts cmd results = [] old_sync = $stdout.sync $stdout.sync = true line = [] begin open("| #{cmd}", "r") do |f| until f.eof? do c = f.getc The code: s.gsub!(/.{4}/n, '\\\\u\&') } string.force_encoding(Encoding::UTF_8) string rescue Iconv::Failure => e raise GeneratorError, "Caught #{e.class}: #{e}" end else def utf8_to_pson(string) # :nodoc: string = string.gsub(/["\\\x0-\x1f]/) { MAP[$&] } string.gsub!(/( becomes: s.gsub!(/.{4}/n, '\\\\u\&') } string.force_encoding(Encoding::UTF_8) string rescue Iconv::Failure => e raise GeneratorError, "Caught #{e.class}: #{e}" end else def utf8_to_pson(string) # :nodoc: string = string.gsub(/["\\\x0-\x1f]/) { MAP[$&] } string.gsub!(/( The code: end } rvalues: rvalue | rvalues comma rvalue { if val[0].instance_of?(AST::ASTArray) result = val[0].push(val[2]) else result = ast AST::ASTArray, :children => [val[0],val[2]] end } becomes: end } rvalues: rvalue | rvalues comma rvalue { if val[0].instance_of?(AST::ASTArray) result = val[0].push(val[2]) else result = ast AST::ASTArray, :children => [val[0],val[2]] end } The code: #passwdproc = proc { @password } keytext = @key.export( OpenSSL::Cipher::DES.new(:EDE3, :CBC), @password ) File.open(@keyfile, "w", 0400) { |f| f << keytext } becomes: # passwdproc = proc { @password } keytext = @key.export( OpenSSL::Cipher::DES.new(:EDE3, :CBC), @password ) File.open(@keyfile, "w", 0400) { |f| f << keytext } The code: end def to_manifest "%s { '%s':\n%s\n}" % [self.type.to_s, self.name, @params.collect { |p, v| if v.is_a? Array " #{p} => [\'#{v.join("','")}\']" else " #{p} => \'#{v}\'" end }.join(",\n") becomes: end def to_manifest "%s { '%s':\n%s\n}" % [self.type.to_s, self.name, @params.collect { |p, v| if v.is_a? Array " #{p} => [\'#{v.join("','")}\']" else " #{p} => \'#{v}\'" end }.join(",\n") The code: via the augeas tool. Requires: - augeas to be installed (http://www.augeas.net) - ruby-augeas bindings Sample usage with a string:: augeas{\"test1\" : context => \"/files/etc/sysconfig/firstboot\", changes => \"set RUN_FIRSTBOOT YES\", becomes: via the augeas tool. Requires: - augeas to be installed (http://www.augeas.net) - ruby-augeas bindings Sample usage with a string:: augeas{\"test1\" : context => \"/files/etc/sysconfig/firstboot\", changes => \"set RUN_FIRSTBOOT YES\", The code: names.should_not be_include("root") end describe "when generating a purgeable resource" do it "should be included in the generated resources" do Puppet::Type.type(:host).stubs(:instances).returns [@purgeable_resource] @resources.generate.collect { |r| r.ref }.should include(@purgeable_resource.ref) end end describe "when the instance's do not have an ensure property" do becomes: names.should_not be_include("root") end describe "when generating a purgeable resource" do it "should be included in the generated resources" do Puppet::Type.type(:host).stubs(:instances).returns [@purgeable_resource] @resources.generate.collect { |r| r.ref }.should include(@purgeable_resource.ref) end end describe "when the instance's do not have an ensure property" do The code: describe "when the instance's do not have an ensure property" do it "should not be included in the generated resources" do @no_ensure_resource = Puppet::Type.type(:exec).new(:name => '/usr/bin/env echo') Puppet::Type.type(:host).stubs(:instances).returns [@no_ensure_resource] @resources.generate.collect { |r| r.ref }.should_not include(@no_ensure_resource.ref) end end describe "when the instance's ensure property does not accept absent" do it "should not be included in the generated resources" do @no_absent_resource = Puppet::Type.type(:service).new(:name => 'foobar') becomes: describe "when the instance's do not have an ensure property" do it "should not be included in the generated resources" do @no_ensure_resource = Puppet::Type.type(:exec).new(:name => '/usr/bin/env echo') Puppet::Type.type(:host).stubs(:instances).returns [@no_ensure_resource] @resources.generate.collect { |r| r.ref }.should_not include(@no_ensure_resource.ref) end end describe "when the instance's ensure property does not accept absent" do it "should not be included in the generated resources" do @no_absent_resource = Puppet::Type.type(:service).new(:name => 'foobar') The code: func = nil assert_nothing_raised do func = Puppet::Parser::AST::Function.new( :name => "template", :ftype => :rvalue, :arguments => AST::ASTArray.new( :children => [stringobj(template)] ) becomes: func = nil assert_nothing_raised do func = Puppet::Parser::AST::Function.new( :name => "template", :ftype => :rvalue, :arguments => AST::ASTArray.new( :children => [stringobj(template)] ) The code: assert( @store.allowed?("hostname.madstop.com", "192.168.1.50"), "hostname not allowed") assert( ! @store.allowed?("name.sub.madstop.com", "192.168.0.50"), "subname name allowed") becomes: assert( @store.allowed?("hostname.madstop.com", "192.168.1.50"), "hostname not allowed") assert( ! @store.allowed?("name.sub.madstop.com", "192.168.0.50"), "subname name allowed") The code: assert_nothing_raised { server = Puppet::Network::Handler.fileserver.new( :Local => true, :Config => false ) } becomes: assert_nothing_raised { server = Puppet::Network::Handler.fileserver.new( :Local => true, :Config => false ) } The code: 'yay', { :failonfail => false, :uid => @user.uid, :gid => @user.gid } ).returns('output') output = Puppet::Util::SUIDManager.run_and_capture 'yay', @user.uid, @user.gid becomes: 'yay', { :failonfail => false, :uid => @user.uid, :gid => @user.gid } ).returns('output') output = Puppet::Util::SUIDManager.run_and_capture 'yay', @user.uid, @user.gid The code: ).times(1) pkg.provider.expects( :aptget ).with( '-y', '-q', 'remove', 'faff' becomes: ).times(1) pkg.provider.expects( :aptget ).with( '-y', '-q', 'remove', 'faff' The code: johnny one two billy three four\n" # Just parse and generate, to make sure it's isomorphic. assert_nothing_raised do assert_equal(text, @parser.to_file(@parser.parse(text)), "parsing was not isomorphic") end end def test_valid_attrs becomes: johnny one two billy three four\n" # Just parse and generate, to make sure it's isomorphic. assert_nothing_raised do assert_equal(text, @parser.to_file(@parser.parse(text)), "parsing was not isomorphic") end end def test_valid_attrs The code: "testing", :onboolean => [true, "An on bool"], :string => ["a string", "A string arg"] ) result = [] should = [] assert_nothing_raised("Add args failed") do @config.addargs(result) end @config.each do |name, element| becomes: "testing", :onboolean => [true, "An on bool"], :string => ["a string", "A string arg"] ) result = [] should = [] assert_nothing_raised("Add args failed") do @config.addargs(result) end @config.each do |name, element|
Diffstat (limited to 'lib/puppet/util')
-rw-r--r--lib/puppet/util/autoload.rb2
-rw-r--r--lib/puppet/util/backups.rb6
-rw-r--r--lib/puppet/util/classgen.rb4
-rw-r--r--lib/puppet/util/command_line.rb5
-rw-r--r--lib/puppet/util/diff.rb9
-rw-r--r--lib/puppet/util/docs.rb2
-rw-r--r--lib/puppet/util/errors.rb3
-rw-r--r--lib/puppet/util/fileparsing.rb4
-rwxr-xr-xlib/puppet/util/filetype.rb13
-rw-r--r--lib/puppet/util/inifile.rb3
-rw-r--r--lib/puppet/util/ldap/connection.rb12
-rw-r--r--lib/puppet/util/log.rb7
-rw-r--r--lib/puppet/util/log/destination.rb2
-rw-r--r--lib/puppet/util/log/destinations.rb14
-rw-r--r--lib/puppet/util/log_paths.rb2
-rw-r--r--lib/puppet/util/metric.rb2
-rw-r--r--lib/puppet/util/monkey_patches.rb2
-rw-r--r--lib/puppet/util/provider_features.rb2
-rw-r--r--lib/puppet/util/pson.rb2
-rw-r--r--lib/puppet/util/rdoc.rb17
-rw-r--r--lib/puppet/util/rdoc/generators/puppet_generator.rb31
-rw-r--r--lib/puppet/util/reference.rb4
-rw-r--r--lib/puppet/util/selinux.rb4
-rw-r--r--lib/puppet/util/settings.rb26
-rw-r--r--lib/puppet/util/settings/boolean_setting.rb9
-rw-r--r--lib/puppet/util/settings/file_setting.rb7
-rw-r--r--lib/puppet/util/settings/setting.rb6
-rw-r--r--lib/puppet/util/storage.rb11
-rw-r--r--lib/puppet/util/subclass_loader.rb9
-rw-r--r--lib/puppet/util/suidmanager.rb11
-rw-r--r--lib/puppet/util/zaml.rb88
31 files changed, 165 insertions, 154 deletions
diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb
index a1c44cdd6..27a361396 100644
--- a/lib/puppet/util/autoload.rb
+++ b/lib/puppet/util/autoload.rb
@@ -66,7 +66,7 @@ class Puppet::Util::Autoload
end
end
- unless defined? @wrap
+ unless defined?(@wrap)
@wrap = true
end
end
diff --git a/lib/puppet/util/backups.rb b/lib/puppet/util/backups.rb
index 6cabd248e..4270f528c 100644
--- a/lib/puppet/util/backups.rb
+++ b/lib/puppet/util/backups.rb
@@ -10,10 +10,10 @@ module Puppet::Util::Backups
# let the path be specified
file ||= self[:path]
- return true unless FileTest.exists?(file)
+ return true unless FileTest.exists?(file)
return perform_backup_with_bucket(file) if self.bucket
- return perform_backup_with_backuplocal(file, self[:backup])
+ return perform_backup_with_backuplocal(file, self[:backup])
end
private
@@ -84,5 +84,5 @@ module Puppet::Util::Backups
sum = self.bucket.backup(f)
self.info "Filebucketed %s to %s with sum %s" % [f, self.bucket.name, sum]
return sum
- end
+ end
end
diff --git a/lib/puppet/util/classgen.rb b/lib/puppet/util/classgen.rb
index 1aa961399..83c302c01 100644
--- a/lib/puppet/util/classgen.rb
+++ b/lib/puppet/util/classgen.rb
@@ -52,7 +52,7 @@ module Puppet::Util::ClassGen
options = symbolize_options(options)
const = genconst_string(name, options)
retval = false
- if const_defined? const
+ if const_defined?(const)
remove_const(const)
retval = true
end
@@ -132,7 +132,7 @@ module Puppet::Util::ClassGen
def handleclassconst(klass, name, options)
const = genconst_string(name, options)
- if const_defined? const
+ if const_defined?(const)
if options[:overwrite]
Puppet.info "Redefining %s in %s" % [name, self]
remove_const(const)
diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb
index 8c8eb91d5..9ccc94a23 100644
--- a/lib/puppet/util/command_line.rb
+++ b/lib/puppet/util/command_line.rb
@@ -1,7 +1,9 @@
module Puppet
module Util
class CommandLine
- LegacyName = Hash.new{|h,k| k}.update({
+
+ LegacyName = Hash.new{|h,k| k}.update(
+ {
'agent' => 'puppetd',
'cert' => 'puppetca',
'doc' => 'puppetdoc',
@@ -12,6 +14,7 @@ module Puppet
'resource' => 'ralsh',
'kick' => 'puppetrun',
'master' => 'puppetmasterd',
+
})
def initialize( zero = $0, argv = ARGV, stdin = STDIN )
diff --git a/lib/puppet/util/diff.rb b/lib/puppet/util/diff.rb
index ac3a1c3c9..0e5deab82 100644
--- a/lib/puppet/util/diff.rb
+++ b/lib/puppet/util/diff.rb
@@ -35,9 +35,12 @@ module Puppet::Util::Diff
diffs.each do |piece|
begin
- hunk = ::Diff::LCS::Hunk.new(data_old, data_new, piece,
- context_lines,
- file_length_difference)
+
+ hunk = ::Diff::LCS::Hunk.new(
+ data_old, data_new, piece,
+ context_lines,
+
+ file_length_difference)
file_length_difference = hunk.file_length_difference
next unless oldhunk
# Hunks may overlap, which is why we need to be careful when our
diff --git a/lib/puppet/util/docs.rb b/lib/puppet/util/docs.rb
index 860a5453c..02374d8b7 100644
--- a/lib/puppet/util/docs.rb
+++ b/lib/puppet/util/docs.rb
@@ -22,7 +22,7 @@ module Puppet::Util::Docs
self.send(m)
}.join(" ")
- if defined? @doc and @doc
+ if defined?(@doc) and @doc
@doc + extra
else
extra
diff --git a/lib/puppet/util/errors.rb b/lib/puppet/util/errors.rb
index 0d2f2da9f..a44c1ca18 100644
--- a/lib/puppet/util/errors.rb
+++ b/lib/puppet/util/errors.rb
@@ -38,8 +38,7 @@ module Puppet::Util::Errors
rescue Puppet::Error => detail
raise adderrorcontext(detail)
rescue => detail
- message = options[:message] || "%s failed with error %s: %s" %
- [self.class, detail.class, detail.to_s]
+ message = options[:message] || "%s failed with error %s: %s" % [self.class, detail.class, detail.to_s]
error = options[:type].new(message)
# We can't use self.fail here because it always expects strings,
diff --git a/lib/puppet/util/fileparsing.rb b/lib/puppet/util/fileparsing.rb
index 06f8a2e7d..7965532fd 100644
--- a/lib/puppet/util/fileparsing.rb
+++ b/lib/puppet/util/fileparsing.rb
@@ -64,7 +64,7 @@ module Puppet::Util::FileParsing
self.separator ||= /\s+/
self.joiner ||= " "
self.optional ||= []
- unless defined? @rollup
+ unless defined?(@rollup)
@rollup = true
end
end
@@ -354,7 +354,7 @@ module Puppet::Util::FileParsing
# Whether to add a trailing separator to the file. Defaults to true
def trailing_separator
- if defined? @trailing_separator
+ if defined?(@trailing_separator)
return @trailing_separator
else
return true
diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb
index 898753226..c2291a3ab 100755
--- a/lib/puppet/util/filetype.rb
+++ b/lib/puppet/util/filetype.rb
@@ -18,9 +18,12 @@ class Puppet::Util::FileType
def self.newfiletype(name, &block)
@filetypes ||= {}
- klass = genclass(name,
+
+ klass = genclass(
+ name,
:block => block,
:prefix => "FileType",
+
:hash => @filetypes
)
@@ -44,8 +47,7 @@ class Puppet::Util::FileType
if Puppet[:trace]
puts detail.backtrace
end
- raise Puppet::Error, "%s could not read %s: %s" %
- [self.class, @path, detail]
+ raise Puppet::Error, "%s could not read %s: %s" % [self.class, @path, detail]
end
end
@@ -62,8 +64,7 @@ class Puppet::Util::FileType
if Puppet[:debug]
puts detail.backtrace
end
- raise Puppet::Error, "%s could not write %s: %s" %
- [self.class, @path, detail]
+ raise Puppet::Error, "%s could not write %s: %s" % [self.class, @path, detail]
end
end
end
@@ -260,7 +261,7 @@ class Puppet::Util::FileType
begin
output = Puppet::Util.execute(%w{crontab -l}, :uid => @path)
if output.include?("You are not authorized to use the cron command")
- raise Puppet::Error, "User %s not authorized to use cron" % @path
+ raise Puppet::Error, "User %s not authorized to use cron" % @path
end
return output
rescue => detail
diff --git a/lib/puppet/util/inifile.rb b/lib/puppet/util/inifile.rb
index eb943fe13..0a957d447 100644
--- a/lib/puppet/util/inifile.rb
+++ b/lib/puppet/util/inifile.rb
@@ -113,8 +113,7 @@ module Puppet::Util::IniConfig
text.each_line do |l|
line += 1
if l.strip.empty? || "#;".include?(l[0,1]) ||
- (l.split(nil, 2)[0].downcase == "rem" &&
- l[0,1].downcase == "r")
+ (l.split(nil, 2)[0].downcase == "rem" && l[0,1].downcase == "r")
# Whitespace or comment
if section.nil?
@files[file] << l
diff --git a/lib/puppet/util/ldap/connection.rb b/lib/puppet/util/ldap/connection.rb
index 19c53a2e6..18d9bf5ab 100644
--- a/lib/puppet/util/ldap/connection.rb
+++ b/lib/puppet/util/ldap/connection.rb
@@ -11,12 +11,12 @@ class Puppet::Util::Ldap::Connection
# Return a default connection, using our default settings.
def self.instance
ssl = if Puppet[:ldaptls]
- :tls
- elsif Puppet[:ldapssl]
- true
- else
- false
- end
+ :tls
+ elsif Puppet[:ldapssl]
+ true
+ else
+ false
+ end
options = {}
options[:ssl] = ssl
diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb
index 237887eb5..57be5f5ba 100644
--- a/lib/puppet/util/log.rb
+++ b/lib/puppet/util/log.rb
@@ -16,9 +16,12 @@ class Puppet::Util::Log
# Create a new destination type.
def self.newdesttype(name, options = {}, &block)
- dest = genclass(name, :parent => Puppet::Util::Log::Destination, :prefix => "Dest",
+
+ dest = genclass(
+ name, :parent => Puppet::Util::Log::Destination, :prefix => "Dest",
:block => block,
:hash => @desttypes,
+
:attributes => options
)
dest.match(dest.name)
@@ -234,7 +237,7 @@ class Puppet::Util::Log
Log.newmessage(self)
end
-
+
def message=(msg)
raise ArgumentError, "Puppet::Util::Log requires a message" unless msg
@message = msg.to_s
diff --git a/lib/puppet/util/log/destination.rb b/lib/puppet/util/log/destination.rb
index 85959072e..81baa9301 100644
--- a/lib/puppet/util/log/destination.rb
+++ b/lib/puppet/util/log/destination.rb
@@ -29,7 +29,7 @@ class Puppet::Util::Log::Destination
end
def name
- if defined? @name
+ if defined?(@name)
return @name
else
return self.class.name
diff --git a/lib/puppet/util/log/destinations.rb b/lib/puppet/util/log/destinations.rb
index e748e5108..9fe61d484 100644
--- a/lib/puppet/util/log/destinations.rb
+++ b/lib/puppet/util/log/destinations.rb
@@ -30,8 +30,7 @@ Puppet::Util::Log.newdesttype :syslog do
if msg.source == "Puppet"
@syslog.send(msg.level, msg.to_s.gsub("%", '%%'))
else
- @syslog.send(msg.level, "(%s) %s" %
- [msg.source.to_s.gsub("%", ""),
+ @syslog.send(msg.level, "(%s) %s" % [msg.source.to_s.gsub("%", ""),
msg.to_s.gsub("%", '%%')
]
)
@@ -43,14 +42,14 @@ Puppet::Util::Log.newdesttype :file do
match(/^\//)
def close
- if defined? @file
+ if defined?(@file)
@file.close
@file = nil
end
end
def flush
- if defined? @file
+ if defined?(@file)
@file.flush
end
end
@@ -74,8 +73,7 @@ Puppet::Util::Log.newdesttype :file do
end
def handle(msg)
- @file.puts("%s %s (%s): %s" %
- [msg.time, msg.source, msg.level, msg.to_s])
+ @file.puts("%s %s (%s): %s" % [msg.time, msg.source, msg.level, msg.to_s])
@file.flush if @autoflush
end
@@ -160,10 +158,10 @@ Puppet::Util::Log.newdesttype :host do
def handle(msg)
unless msg.is_a?(String) or msg.remote
- unless defined? @hostname
+ unless defined?(@hostname)
@hostname = Facter["hostname"].value
end
- unless defined? @domain
+ unless defined?(@domain)
@domain = Facter["domain"].value
if @domain
@hostname += "." + @domain
diff --git a/lib/puppet/util/log_paths.rb b/lib/puppet/util/log_paths.rb
index 46f6c481d..b5bdc50de 100644
--- a/lib/puppet/util/log_paths.rb
+++ b/lib/puppet/util/log_paths.rb
@@ -5,7 +5,7 @@ module Puppet::Util::LogPaths
# return the full path to us, for logging and rollback
# some classes (e.g., FileTypeRecords) will have to override this
def path
- unless defined? @path
+ unless defined?(@path)
@path = pathbuilder
end
diff --git a/lib/puppet/util/metric.rb b/lib/puppet/util/metric.rb
index 8717fe0b9..cf8ed9ee1 100644
--- a/lib/puppet/util/metric.rb
+++ b/lib/puppet/util/metric.rb
@@ -19,7 +19,7 @@ class Puppet::Util::Metric
end
def basedir
- if defined? @basedir
+ if defined?(@basedir)
@basedir
else
Puppet[:rrddir]
diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb
index a25be7d52..e5e835ef0 100644
--- a/lib/puppet/util/monkey_patches.rb
+++ b/lib/puppet/util/monkey_patches.rb
@@ -1,6 +1,6 @@
Process.maxgroups = 1024
-module RDoc
+module RDoc
def self.caller(skip=nil)
in_gem_wrapper = false
Kernel.caller.reject { |call|
diff --git a/lib/puppet/util/provider_features.rb b/lib/puppet/util/provider_features.rb
index 7986f6eae..86f30cc8b 100644
--- a/lib/puppet/util/provider_features.rb
+++ b/lib/puppet/util/provider_features.rb
@@ -107,7 +107,7 @@ module Puppet::Util::ProviderFeatures
# Generate a module that sets up the boolean methods to test for given
# features.
def feature_module
- unless defined? @feature_module
+ unless defined?(@feature_module)
@features ||= {}
@feature_module = ::Module.new
const_set("FeatureModule", @feature_module)
diff --git a/lib/puppet/util/pson.rb b/lib/puppet/util/pson.rb
index 3356437b3..87afbe0c5 100644
--- a/lib/puppet/util/pson.rb
+++ b/lib/puppet/util/pson.rb
@@ -1,4 +1,4 @@
-# A simple module to provide consistency between how we use PSON and how
+# A simple module to provide consistency between how we use PSON and how
# ruby expects it to be used. Basically, we don't want to require
# that the sender specify a class.
# Ruby wants everyone to provide a 'type' field, and the PSON support
diff --git a/lib/puppet/util/rdoc.rb b/lib/puppet/util/rdoc.rb
index cb9610c0a..1bc48abd0 100644
--- a/lib/puppet/util/rdoc.rb
+++ b/lib/puppet/util/rdoc.rb
@@ -16,15 +16,18 @@ module Puppet::Util::RDoc
require 'puppet/util/rdoc/parser'
r = RDoc::RDoc.new
- RDoc::RDoc::GENERATORS["puppet"] = RDoc::RDoc::Generator.new("puppet/util/rdoc/generators/puppet_generator.rb",
- "PuppetGenerator".intern,
- "puppet")
+
+ RDoc::RDoc::GENERATORS["puppet"] = RDoc::RDoc::Generator.new(
+ "puppet/util/rdoc/generators/puppet_generator.rb",
+ "PuppetGenerator".intern,
+
+ "puppet")
# specify our own format & where to output
options = [ "--fmt", "puppet",
- "--quiet",
- "--force-update",
- "--exclude", "/modules/[^/]*/files/.*\.pp$",
- "--op", outputdir ]
+ "--quiet",
+ "--force-update",
+ "--exclude", "/modules/[^/]*/files/.*\.pp$",
+ "--op", outputdir ]
options += [ "--charset", charset] if charset
options += files
diff --git a/lib/puppet/util/rdoc/generators/puppet_generator.rb b/lib/puppet/util/rdoc/generators/puppet_generator.rb
index 31181f05a..c2c27c8eb 100644
--- a/lib/puppet/util/rdoc/generators/puppet_generator.rb
+++ b/lib/puppet/util/rdoc/generators/puppet_generator.rb
@@ -215,9 +215,12 @@ module Generators
gen_an_index(@classes, 'All Classes', RDoc::Page::CLASS_INDEX, "fr_class_index.html")
@allfiles.each do |file|
unless file['file'].context.file_relative_name =~ /\.rb$/
- gen_composite_index(file,
- RDoc::Page::COMBO_INDEX,
- "#{MODULE_DIR}/fr_#{file["file"].context.module_name}.html")
+
+ gen_composite_index(
+ file,
+ RDoc::Page::COMBO_INDEX,
+
+ "#{MODULE_DIR}/fr_#{file["file"].context.module_name}.html")
end
end
end
@@ -365,8 +368,8 @@ module Generators
res = []
resources.each do |r|
res << {
- "name" => CGI.escapeHTML(r.name),
- "aref" => CGI.escape(path_prefix)+"\#"+CGI.escape(r.aref)
+ "name" => CGI.escapeHTML(r.name),
+ "aref" => CGI.escape(path_prefix)+"\#"+CGI.escape(r.aref)
}
end
res
@@ -480,9 +483,12 @@ module Generators
def write_on(f)
value_hash
- template = TemplatePage.new(RDoc::Page::BODYINC,
- RDoc::Page::NODE_PAGE,
- RDoc::Page::METHOD_LIST)
+
+ template = TemplatePage.new(
+ RDoc::Page::BODYINC,
+ RDoc::Page::NODE_PAGE,
+
+ RDoc::Page::METHOD_LIST)
template.write_html_on(f, @values)
end
@@ -733,9 +739,12 @@ module Generators
def write_on(f)
value_hash
- template = TemplatePage.new(RDoc::Page::BODYINC,
- RDoc::Page::PLUGIN_PAGE,
- RDoc::Page::PLUGIN_LIST)
+
+ template = TemplatePage.new(
+ RDoc::Page::BODYINC,
+ RDoc::Page::PLUGIN_PAGE,
+
+ RDoc::Page::PLUGIN_LIST)
template.write_html_on(f, @values)
end
diff --git a/lib/puppet/util/reference.rb b/lib/puppet/util/reference.rb
index a1679bcb6..f34e54b8c 100644
--- a/lib/puppet/util/reference.rb
+++ b/lib/puppet/util/reference.rb
@@ -70,7 +70,7 @@ class Puppet::Util::Reference
def self.markdown(name, text)
puts "Creating markdown for #{name} reference."
dir = "/tmp/" + Puppet::PUPPETVERSION
- FileUtils.mkdir(dir) unless File.directory?(dir)
+ FileUtils.mkdir(dir) unless File.directory?(dir)
Puppet::Util.secure_open(dir + "/" + "#{name}.rst", "w") do |f|
f.puts text
end
@@ -89,7 +89,7 @@ class Puppet::Util::Reference
$stderr.puts output
exit(1)
end
-
+
File.unlink(dir + "/" + "#{name}.rst")
end
diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb
index 3801ecdb0..28752cfac 100644
--- a/lib/puppet/util/selinux.rb
+++ b/lib/puppet/util/selinux.rb
@@ -14,7 +14,7 @@ require 'pathname'
module Puppet::Util::SELinux
def selinux_support?
- unless defined? Selinux
+ unless defined?(Selinux)
return false
end
if Selinux.is_selinux_enabled == 1
@@ -89,7 +89,7 @@ module Puppet::Util::SELinux
# I believe that the OS should always provide at least a fall-through context
# though on any well-running system.
def set_selinux_context(file, value, component = false)
- unless selinux_support? && selinux_label_support?(file)
+ unless selinux_support? && selinux_label_support?(file)
return nil
end
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb
index 56a13f847..3a823d30b 100644
--- a/lib/puppet/util/settings.rb
+++ b/lib/puppet/util/settings.rb
@@ -67,7 +67,7 @@ class Puppet::Util::Settings
unsafe_clear(exceptcli)
end
end
-
+
# Remove all set values, potentially skipping cli values.
def unsafe_clear(exceptcli = false)
@values.each do |name, values|
@@ -227,8 +227,8 @@ class Puppet::Util::Settings
if include?(v)
#if there is only one value, just print it for back compatibility
if v == val
- puts value(val,env)
- break
+ puts value(val,env)
+ break
end
puts "%s = %s" % [v, value(v,env)]
else
@@ -434,7 +434,7 @@ class Puppet::Util::Settings
end
def reuse
- return unless defined? @used
+ return unless defined?(@used)
@sync.synchronize do # yay, thread-safe
new = @used
@used = []
@@ -477,7 +477,7 @@ class Puppet::Util::Settings
end
def legacy_to_mode(type, param)
- if not defined? @app_names then
+ if not defined?(@app_names) then
require 'puppet/util/command_line'
command_line = Puppet::Util::CommandLine.new
@app_names = Puppet::Util::CommandLine::LegacyName.inject({}) do |hash, pair|
@@ -524,7 +524,7 @@ class Puppet::Util::Settings
# Clear the list of environments, because they cache, at least, the module path.
# We *could* preferentially just clear them if the modulepath is changed,
# but we don't really know if, say, the vardir is changed and the modulepath
- # is defined relative to it. We need the defined? stuff because of loading
+ # is defined relative to it. We need the defined?(stuff) because of loading
# order issues.
Puppet::Node::Environment.clear if defined?(Puppet::Node) and defined?(Puppet::Node::Environment)
end
@@ -610,9 +610,9 @@ Generated on #{Time.now}.
}.gsub(/^/, "# ")
- # Add a section heading that matches our name.
- if @config.include?(:run_mode)
- str += "[%s]\n" % self[:run_mode]
+# Add a section heading that matches our name.
+if @config.include?(:run_mode)
+ str += "[%s]\n" % self[:run_mode]
end
eachsection do |section|
persection(section) do |obj|
@@ -689,7 +689,7 @@ Generated on #{Time.now}.
end
throw :foundval, nil
end
-
+
# If we didn't get a value, use the default
val = @config[param].default if val.nil?
@@ -769,16 +769,14 @@ Generated on #{Time.now}.
tmpfile = file + ".tmp"
sync = Sync.new
unless FileTest.directory?(File.dirname(tmpfile))
- raise Puppet::DevError, "Cannot create %s; directory %s does not exist" %
- [file, File.dirname(file)]
+ raise Puppet::DevError, "Cannot create %s; directory %s does not exist" % [file, File.dirname(file)]
end
sync.synchronize(Sync::EX) do
File.open(file, ::File::CREAT|::File::RDWR, 0600) do |rf|
rf.lock_exclusive do
if File.exist?(tmpfile)
- raise Puppet::Error, ".tmp file already exists for %s; Aborting locked write. Check the .tmp file and delete if appropriate" %
- [file]
+ raise Puppet::Error, ".tmp file already exists for %s; Aborting locked write. Check the .tmp file and delete if appropriate" % [file]
end
# If there's a failure, remove our tmpfile
diff --git a/lib/puppet/util/settings/boolean_setting.rb b/lib/puppet/util/settings/boolean_setting.rb
index cc2704c4e..aa365fd8e 100644
--- a/lib/puppet/util/settings/boolean_setting.rb
+++ b/lib/puppet/util/settings/boolean_setting.rb
@@ -5,11 +5,9 @@ class Puppet::Util::Settings::BooleanSetting < Puppet::Util::Settings::Setting
# get the arguments in getopt format
def getopt_args
if short
- [["--#{name}", "-#{short}", GetoptLong::NO_ARGUMENT],
- ["--no-#{name}", GetoptLong::NO_ARGUMENT]]
+ [["--#{name}", "-#{short}", GetoptLong::NO_ARGUMENT], ["--no-#{name}", GetoptLong::NO_ARGUMENT]]
else
- [["--#{name}", GetoptLong::NO_ARGUMENT],
- ["--no-#{name}", GetoptLong::NO_ARGUMENT]]
+ [["--#{name}", GetoptLong::NO_ARGUMENT], ["--no-#{name}", GetoptLong::NO_ARGUMENT]]
end
end
@@ -26,8 +24,7 @@ class Puppet::Util::Settings::BooleanSetting < Puppet::Util::Settings::Setting
when true, "true"; return true
when false, "false"; return false
else
- raise ArgumentError, "Invalid value '%s' for %s" %
- [value.inspect, @name]
+ raise ArgumentError, "Invalid value '%s' for %s" % [value.inspect, @name]
end
end
end
diff --git a/lib/puppet/util/settings/file_setting.rb b/lib/puppet/util/settings/file_setting.rb
index 6f0f315eb..815bdcf52 100644
--- a/lib/puppet/util/settings/file_setting.rb
+++ b/lib/puppet/util/settings/file_setting.rb
@@ -16,7 +16,7 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting
def group=(value)
unless AllowedGroups.include?(value)
- identifying_fields = [desc,name,default].compact.join(': ')
+ identifying_fields = [desc,name,default].compact.join(': ')
raise SettingError, "Internal error: The :group setting for %s must be 'service', not '%s'" % [identifying_fields,value]
end
@group = value
@@ -29,7 +29,7 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting
def owner=(value)
unless AllowedOwners.include?(value)
- identifying_fields = [desc,name,default].compact.join(': ')
+ identifying_fields = [desc,name,default].compact.join(': ')
raise SettingError, "Internal error: The :owner setting for %s must be either 'root' or 'service', not '%s'" % [identifying_fields,value]
end
@owner = value
@@ -115,8 +115,7 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting
name = $1
unless @settings.include?(name)
raise ArgumentError,
- "Settings parameter '%s' is undefined" %
- name
+ "Settings parameter '%s' is undefined" % name
end
}
end
diff --git a/lib/puppet/util/settings/setting.rb b/lib/puppet/util/settings/setting.rb
index e64cfd6c6..489dfd01d 100644
--- a/lib/puppet/util/settings/setting.rb
+++ b/lib/puppet/util/settings/setting.rb
@@ -54,7 +54,7 @@ class Puppet::Util::Settings::Setting
end
def iscreated?
- if defined? @iscreated
+ if defined?(@iscreated)
return @iscreated
else
return false
@@ -62,7 +62,7 @@ class Puppet::Util::Settings::Setting
end
def set?
- if defined? @value and ! @value.nil?
+ if defined?(@value) and ! @value.nil?
return true
else
return false
@@ -82,7 +82,7 @@ class Puppet::Util::Settings::Setting
str = @desc.gsub(/^/, "# ") + "\n"
# Add in a statement about the default.
- if defined? @default and @default
+ if defined?(@default) and @default
str += "# The default value is '%s'.\n" % @default
end
diff --git a/lib/puppet/util/storage.rb b/lib/puppet/util/storage.rb
index de2f3825e..076952c1d 100644
--- a/lib/puppet/util/storage.rb
+++ b/lib/puppet/util/storage.rb
@@ -47,7 +47,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 defined?(@@state) and ! @@state.nil?
self.init
end
return
@@ -61,15 +61,12 @@ class Puppet::Util::Storage
begin
@@state = YAML.load(file)
rescue => detail
- Puppet.err "Checksumfile %s is corrupt (%s); replacing" %
- [Puppet[:statefile], detail]
+ Puppet.err "Checksumfile %s is corrupt (%s); replacing" % [Puppet[:statefile], detail]
begin
- File.rename(Puppet[:statefile],
- Puppet[:statefile] + ".bad")
+ File.rename(Puppet[:statefile], Puppet[:statefile] + ".bad")
rescue
raise Puppet::Error,
- "Could not rename corrupt %s; remove manually" %
- Puppet[:statefile]
+ "Could not rename corrupt %s; remove manually" % Puppet[:statefile]
end
end
end
diff --git a/lib/puppet/util/subclass_loader.rb b/lib/puppet/util/subclass_loader.rb
index b71ec7293..80a3672c9 100644
--- a/lib/puppet/util/subclass_loader.rb
+++ b/lib/puppet/util/subclass_loader.rb
@@ -19,7 +19,10 @@ module Puppet::Util::SubclassLoader
raise ArgumentError, "Must be a class to use SubclassLoader"
end
@subclasses = []
- @loader = Puppet::Util::Autoload.new(self,
+
+ @loader = Puppet::Util::Autoload.new(
+ self,
+
path, :wrap => false
)
@@ -63,7 +66,7 @@ module Puppet::Util::SubclassLoader
unless self == self.classloader
super
end
- return nil unless defined? @subclassname
+ return nil unless defined?(@subclassname)
if c = self.send(@subclassname, method)
return c
else
@@ -73,7 +76,7 @@ module Puppet::Util::SubclassLoader
# Retrieve or calculate a name.
def name(dummy_argument=:work_arround_for_ruby_GC_bug)
- unless defined? @name
+ unless defined?(@name)
@name = self.to_s.sub(/.+::/, '').intern
end
diff --git a/lib/puppet/util/suidmanager.rb b/lib/puppet/util/suidmanager.rb
index 777c36411..b8e7d534c 100644
--- a/lib/puppet/util/suidmanager.rb
+++ b/lib/puppet/util/suidmanager.rb
@@ -6,8 +6,7 @@ module Puppet::Util::SUIDManager
extend Forwardable
# Note groups= is handled specially due to a bug in OS X 10.6
- to_delegate_to_process = [ :euid=, :euid, :egid=, :egid,
- :uid=, :uid, :gid=, :gid, :groups ]
+ to_delegate_to_process = [ :euid=, :euid, :egid=, :egid, :uid=, :uid, :gid=, :gid, :groups ]
to_delegate_to_process.each do |method|
def_delegator Process, method
@@ -19,8 +18,8 @@ module Puppet::Util::SUIDManager
require 'facter'
# 'kernel' is available without explicitly loading all facts
if Facter.value('kernel') != 'Darwin'
- @osx_maj_ver = false
- return @osx_maj_ver
+ @osx_maj_ver = false
+ return @osx_maj_ver
end
# But 'macosx_productversion_major' requires it.
Facter.loadfacts
@@ -28,7 +27,7 @@ module Puppet::Util::SUIDManager
return @osx_maj_ver
end
module_function :osx_maj_ver
-
+
def groups=(grouplist)
if osx_maj_ver == '10.6'
return true
@@ -75,7 +74,7 @@ module Puppet::Util::SUIDManager
raise ArgumentError, "Invalid id type %s" % type unless map.include?(type)
ret = Puppet::Util.send(type, id)
if ret == nil
- raise Puppet::Error, "Invalid %s: %s" % [map[type], id]
+ raise Puppet::Error, "Invalid %s: %s" % [map[type], id]
end
return ret
end
diff --git a/lib/puppet/util/zaml.rb b/lib/puppet/util/zaml.rb
index b0e22a3ff..88c660cac 100644
--- a/lib/puppet/util/zaml.rb
+++ b/lib/puppet/util/zaml.rb
@@ -1,14 +1,14 @@
#
# ZAML -- A partial replacement for YAML, writen with speed and code clarity
-# in mind. ZAML fixes one YAML bug (loading Exceptions) and provides
+# in mind. ZAML fixes one YAML bug (loading Exceptions) and provides
# a replacement for YAML.dump() unimaginatively called ZAML.dump(),
-# which is faster on all known cases and an order of magnitude faster
+# which is faster on all known cases and an order of magnitude faster
# with complex structures.
#
# http://github.com/hallettj/zaml
#
# Authors: Markus Roberts, Jesse Hallett, Ian McIntosh, Igal Koshevoy, Simon Chiang
-#
+#
require 'yaml'
@@ -40,19 +40,19 @@ class ZAML
end
class Label
#
- # YAML only wants objects in the datastream once; if the same object
- # occurs more than once, we need to emit a label ("&idxxx") on the
+ # YAML only wants objects in the datastream once; if the same object
+ # occurs more than once, we need to emit a label ("&idxxx") on the
# first occurrence and then emit a back reference (*idxxx") on any
- # subsequent occurrence(s).
+ # subsequent occurrence(s).
#
# To accomplish this we keeps a hash (by object id) of the labels of
# the things we serialize as we begin to serialize them. The labels
# initially serialize as an empty string (since most objects are only
- # going to be be encountered once), but can be changed to a valid
- # (by assigning it a number) the first time it is subsequently used,
- # if it ever is. Note that we need to do the label setup BEFORE we
- # start to serialize the object so that circular structures (in
- # which we will encounter a reference to the object as we serialize
+ # going to be be encountered once), but can be changed to a valid
+ # (by assigning it a number) the first time it is subsequently used,
+ # if it ever is. Note that we need to do the label setup BEFORE we
+ # start to serialize the object so that circular structures (in
+ # which we will encounter a reference to the object as we serialize
# it can be handled).
#
def self.counter_reset
@@ -81,9 +81,9 @@ class ZAML
def first_time_only(obj)
if label = Label.for(obj)
emit(label.reference)
- else
+ else
if @structured_key_prefix and not obj.is_a? String
- emit(@structured_key_prefix)
+ emit(@structured_key_prefix)
@structured_key_prefix = nil
end
emit(new_label_for(obj))
@@ -95,7 +95,7 @@ class ZAML
@recent_nl = false unless s.kind_of?(Label)
end
def nl(s='')
- emit(@indent || "\n") unless @recent_nl
+ emit(@indent || "\n") unless @recent_nl
emit(s)
@recent_nl = true
end
@@ -126,19 +126,19 @@ class Object
end
def to_zaml(z)
z.first_time_only(self) {
- z.emit(zamlized_class_name(Object))
+ z.emit(zamlized_class_name(Object))
z.nested {
instance_variables = to_yaml_properties
if instance_variables.empty?
z.emit(" {}")
- else
+ else
instance_variables.each { |v|
z.nl
v[1..-1].to_zaml(z) # Remove leading '@'
z.emit(': ')
instance_variable_get(v).to_zaml(z)
}
- end
+ end
}
}
end
@@ -221,50 +221,50 @@ class String
gsub( /([\x80-\xFF])/ ) { |x| "\\x#{x.unpack("C")[0].to_s(16)}" }
end
def to_zaml(z)
- z.first_time_only(self) {
+ z.first_time_only(self) {
num = '[-+]?(0x)?\d+\.?\d*'
case
- when self == ''
- z.emit('""')
- # when self =~ /[\x00-\x08\x0B\x0C\x0E-\x1F\x80-\xFF]/
- # z.emit("!binary |\n")
- # z.emit([self].pack("m*"))
- when (
- (self =~ /\A(true|false|yes|no|on|null|off|#{num}(:#{num})*|!|=|~)$/i) or
+ when self == ''
+ z.emit('""')
+ # when self =~ /[\x00-\x08\x0B\x0C\x0E-\x1F\x80-\xFF]/
+ # z.emit("!binary |\n")
+ # z.emit([self].pack("m*"))
+ when (
+ (self =~ /\A(true|false|yes|no|on|null|off|#{num}(:#{num})*|!|=|~)$/i) or
(self =~ /\A\n* /) or
(self =~ /[\s:]$/) or
(self =~ /^[>|][-+\d]*\s/i) or
- (self[-1..-1] =~ /\s/) or
+ (self[-1..-1] =~ /\s/) or
(self =~ /[\x00-\x08\x0B\x0C\x0E-\x1F\x80-\xFF]/) or
- (self =~ /[,\[\]\{\}\r\t]|:\s|\s#/) or
- (self =~ /\A([-:?!#&*'"]|<<|%.+:.)/)
+ (self =~ /[,\[\]\{\}\r\t]|:\s|\s#/) or
+ (self =~ /\A([-:?!#&*'"]|<<|%.+:.)/)
)
- z.emit("\"#{escaped_for_zaml}\"")
- when self =~ /\n/
- if self[-1..-1] == "\n" then z.emit('|+') else z.emit('|-') end
- z.nested { split("\n",-1).each { |line| z.nl; z.emit(line.chomp("\n")) } }
- z.nl
- else
- z.emit(self)
- end
+ z.emit("\"#{escaped_for_zaml}\"")
+ when self =~ /\n/
+ if self[-1..-1] == "\n" then z.emit('|+') else z.emit('|-') end
+ z.nested { split("\n",-1).each { |line| z.nl; z.emit(line.chomp("\n")) } }
+ z.nl
+ else
+ z.emit(self)
+ end
}
end
end
class Hash
def to_zaml(z)
- z.first_time_only(self) {
+ z.first_time_only(self) {
z.nested {
if empty?
z.emit('{}')
- else
+ else
each_pair { |k, v|
z.nl
z.prefix_structured_keys('? ') { k.to_zaml(z) }
z.emit(': ')
v.to_zaml(z)
}
- end
+ end
}
}
end
@@ -273,13 +273,13 @@ end
class Array
def to_zaml(z)
z.first_time_only(self) {
- z.nested {
+ z.nested {
if empty?
z.emit('[]')
- else
+ else
each { |v| z.nl('- '); v.to_zaml(z) }
- end
- }
+ end
+ }
}
end
end
@@ -302,7 +302,7 @@ end
class Range
def to_zaml(z)
z.first_time_only(self) {
- z.emit(zamlized_class_name(Range))
+ z.emit(zamlized_class_name(Range))
z.nested {
z.nl
z.emit('begin: ')