module Puppet::Interface::DocGen

@api private

Public Instance Methods

attr_doc(name, &validate) click to toggle source

@api private

# File lib/puppet/interface/documentation.rb, line 21
    def attr_doc(name, &validate)
      # Now, which form of the setter do we want, validated or not?
      get_arg = "value.to_s"
      if validate
        define_method(:"_validate_#{name}", validate)
        get_arg = "_validate_#{name}(#{get_arg})"
      end

      # We use module_eval, which I don't like much, because we can't have an
      # argument to a block with a default value in Ruby 1.8, and I don't like
      # the side-effects (eg: no argument count validation) of using blocks
      # without as metheds.  When we are 1.9 only (hah!) you can totally
      # replace this with some up-and-up define_method. --daniel 2011-04-29
      module_eval("        def #{name}(value = nil)
          self.#{name} = value unless value.nil?
          @#{name}
        end

        def #{name}=(value)
          @#{name} = Puppet::Interface::DocGen.strip_whitespace(#{get_arg})
        end
", __FILE__, __LINE__ + 1)
    end

Public Class Methods

strip_whitespace(text) click to toggle source

@api private

# File lib/puppet/interface/documentation.rb, line 7
def self.strip_whitespace(text)
  # I don't want no...
  Puppet::Util::Docs.scrub(text)
end