diff options
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/interface.rb | 9 | ||||
| -rw-r--r-- | lib/puppet/interface/action.rb | 15 |
2 files changed, 22 insertions, 2 deletions
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb index 5e9355061..4a36b509a 100644 --- a/lib/puppet/interface.rb +++ b/lib/puppet/interface.rb @@ -70,9 +70,16 @@ class Puppet::Interface attr_accessor :summary def summary(value = nil) - @summary = value unless value.nil? + value.nil? or summary = value @summary end + def summary=(value) + value = value.to_s + value =~ /\n/ and + raise ArgumentError, "Face summary should be a single line; put the long text in 'description' instead." + + @summary = value + end attr_reader :name, :version diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb index b94298963..d2d4facaa 100644 --- a/lib/puppet/interface/action.rb +++ b/lib/puppet/interface/action.rb @@ -24,8 +24,21 @@ class Puppet::Interface::Action attr_reader :name def to_s() "#{@face}##{@name}" end - attr_accessor :default, :summary + attr_accessor :default + ######################################################################## + # Documentation stuff, whee! + attr_accessor :summary + def summary=(value) + value = value.to_s + value =~ /\n/ and + raise ArgumentError, "Face summary should be a single line; put the long text in 'description' instead." + + @summary = value + end + + + ######################################################################## # Initially, this was defined to allow the @action.invoke pattern, which is # a very natural way to invoke behaviour given our introspection # capabilities. Heck, our initial plan was to have the faces delegate to |
