> diff --git a/lib/puppet/util/reference.rb b/lib/puppet/util/reference.rb
> index 99458aa..ab201cd 100644
> --- a/lib/puppet/util/reference.rb
> +++ b/lib/puppet/util/reference.rb
> @@ -32,7 +32,6 @@ class Puppet::Util::Reference
> section = reference(name) or raise "Could not find section #{name}"
> depth = section.depth if section.depth < depth
> end
> - text = "* TOC text.\n{:toc}\n\n"
> end
>
The first change eliminates the return value of the method (in context):
def self.page(*sections)
depth = 4
# Use the minimum depth
sections.each do |name|
section = reference(name) or raise "Could not find section #{name}"
depth = section.depth if section.depth < depth
end
text = "* TOC text.\n{:toc}\n\n"
end
Since the local variable "text" isn't used after this point the only effect
of the assignment is to set the return value. However I also note that
"depth" isn't used either, meaning the whole thing was originally equivalent
to:
def self.page(*sections)
sections.each { |name| reference(name) or raise "Could not find section
#{name}" }
"* TOC text.\n{:toc}\n\n"
end
assuming that reference(name) has side effects we care about or can return
nil to produce errors we want. If neither is the case the original boils
down to:
def self.page(*sections)
"* TOC text.\n{:toc}\n\n"
end
making the modified version equivalent to:
def self.page(*sections)
sections
end
which is at least easy to understand.
Trying to determine what reference does led me into
lib/puppet/util/instance_loader.rb which I wasn't in the mood for this
afternoon so I decided to find out where Puppet::Util::Reference.page is
called and could not find any use of it. Removing the method completely
doesn't have any effect that I could see (running tests, running puppetdoc,
consulting I Ching, etc.)
Does anyone see any reason not to just remove the method as dead code?
-- M
-----------------------------------------------------------
When in trouble or in doubt, run in circles,
scream and shout. -- 1920's parody of the
maritime general prudential rule
------------------------------------------------------------
--
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.