diff options
author | Luke Kanies <luke@madstop.com> | 2009-10-06 09:03:25 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-12-09 02:13:02 +1100 |
commit | 22c642df7e705792373c605422d368236e6f5a94 (patch) | |
tree | f96a905f551d66751a458acb2aa63a353caac07a /lib/puppet | |
parent | adc211ad191568e84eb3e1f618f1cbf78df95ba9 (diff) | |
download | puppet-22c642df7e705792373c605422d368236e6f5a94.tar.gz puppet-22c642df7e705792373c605422d368236e6f5a94.tar.xz puppet-22c642df7e705792373c605422d368236e6f5a94.zip |
Extracting language doc support into a module
This is so that you can still use docs without AST
being the parent class.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/util/inline_docs.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/puppet/util/inline_docs.rb b/lib/puppet/util/inline_docs.rb new file mode 100644 index 000000000..405b53945 --- /dev/null +++ b/lib/puppet/util/inline_docs.rb @@ -0,0 +1,29 @@ +module Puppet::Util::InlineDocs + def self.included(klass) + klass.send(:include, InstanceMethods) + klass.extend ClassMethods + end + + module ClassMethods + attr_accessor :use_docs + def associates_doc + self.use_docs = true + end + end + + module InstanceMethods + attr_writer :doc + + def doc + unless defined?(@doc) and @doc + @doc = "" + end + @doc + end + + # don't fetch lexer comment by default + def use_docs + self.class.use_docs + end + end +end |