summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@puppetlabs.com>2011-02-22 13:36:18 -0800
committerLuke Kanies <luke@puppetlabs.com>2011-02-22 13:36:18 -0800
commit7da0a26f1bd44ecfffe9f622ec9d560870506207 (patch)
treebef87a0d9880b3878a50ea8c2be0e80ccd90b438
parent04fb6de5e2108799e47a081e5331d932fcf53109 (diff)
downloadpuppet-7da0a26f1bd44ecfffe9f622ec9d560870506207.tar.gz
puppet-7da0a26f1bd44ecfffe9f622ec9d560870506207.tar.xz
puppet-7da0a26f1bd44ecfffe9f622ec9d560870506207.zip
Adding a string form to interfaces
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
-rw-r--r--lib/puppet/interface.rb4
-rw-r--r--spec/unit/interface_spec.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb
index 901e83af6..70356debc 100644
--- a/lib/puppet/interface.rb
+++ b/lib/puppet/interface.rb
@@ -103,4 +103,8 @@ class Puppet::Interface
instance_eval(&block)
end
end
+
+ def to_s
+ name.to_s
+ end
end
diff --git a/spec/unit/interface_spec.rb b/spec/unit/interface_spec.rb
index 4fe797b6b..5d25623e7 100644
--- a/spec/unit/interface_spec.rb
+++ b/spec/unit/interface_spec.rb
@@ -32,6 +32,10 @@ describe Puppet::Interface do
end
end
+ it "should use its name converted to a string as its string form" do
+ Puppet::Interface.new(:me).to_s.should == "me"
+ end
+
it "should allow overriding of the default format" do
face = Puppet::Interface.new(:me)
face.set_default_format :foo