diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-28 16:30:49 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-28 16:30:49 +0000 |
commit | d45d22b7547a608c7821905024f530bbae1259d7 (patch) | |
tree | 018f311b26a7854271524beba90a778918bd7ee6 /lib/puppet/util/docs.rb | |
parent | e1aff4cd2f456bfc9567e9be5dd73b3c8ed14ec9 (diff) | |
download | puppet-d45d22b7547a608c7821905024f530bbae1259d7.tar.gz puppet-d45d22b7547a608c7821905024f530bbae1259d7.tar.xz puppet-d45d22b7547a608c7821905024f530bbae1259d7.zip |
Adding a module specifically for making doc generation easier, and adding defaults info to provider docs.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1504 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/util/docs.rb')
-rw-r--r-- | lib/puppet/util/docs.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/puppet/util/docs.rb b/lib/puppet/util/docs.rb new file mode 100644 index 000000000..2fccd4abc --- /dev/null +++ b/lib/puppet/util/docs.rb @@ -0,0 +1,27 @@ +# Some simple methods for helping manage automatic documentation generation. +module Puppet::Util::Docs + # Specify the actual doc string. + def desc(str) + @doc = str + end + + # Add a new autodoc block. We have to define these as class methods, + # rather than just sticking them in a hash, because otherwise they're + # too difficult to do inheritance with. + def dochook(name, &block) + method = "dochook_" + name.to_s + + meta_def method, &block + end + + # Generate the full doc string. + def doc + extra = methods.find_all { |m| m.to_s =~ /^dochook_.+/ }.collect { |m| + self.send(m) + }.join(" ") + + @doc + extra + end +end + +# $Id$ |