diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-01 13:10:42 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-02 15:51:23 -0700 |
| commit | 1400fec62e4e692badc5b68eb7d6d947997d7204 (patch) | |
| tree | 92d8be57ba025d09a7506a3c02cfc08034cdfc86 /lib | |
| parent | 05b434dca10bbc18d794358a9d08db89a46424f9 (diff) | |
| download | puppet-1400fec62e4e692badc5b68eb7d6d947997d7204.tar.gz puppet-1400fec62e4e692badc5b68eb7d6d947997d7204.tar.xz puppet-1400fec62e4e692badc5b68eb7d6d947997d7204.zip | |
MAINT: nicer to_s for actions, for user-focused rendering.
This makes it possible for us to just print the Action object directly and get
a human-focused output string.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/string/action.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/puppet/string/action.rb b/lib/puppet/string/action.rb index 4db9e97e2..5a7f3f203 100644 --- a/lib/puppet/string/action.rb +++ b/lib/puppet/string/action.rb @@ -3,6 +3,10 @@ require 'puppet/string' class Puppet::String::Action attr_reader :name + def to_s + "#{@string}##{@name}" + end + def initialize(string, name, attrs = {}) name = name.to_s raise "'#{name}' is an invalid action name" unless name =~ /^[a-z]\w*$/ |
