summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2014-12-19 12:25:21 +0100
committerTravis Fields <travis@puppetlabs.com>2015-03-05 10:59:31 -0800
commit56d815bcfc5f57d8dff974fd8bba192c6b141f89 (patch)
treed64a5cf7d5223e6bcba82248108ca32dd10ecadf
parent706b9e8205f1ff205226ef53e7d9b58de5cb6e54 (diff)
downloadpuppet-stdlib-56d815bcfc5f57d8dff974fd8bba192c6b141f89.tar.gz
puppet-stdlib-56d815bcfc5f57d8dff974fd8bba192c6b141f89.tar.bz2
Rename private() to assert_private()
As mentioned in #270, private is a reserved keyword in the future parser which is to be released with Puppet 4. As it stands, this function is not useable with the future parser so it needs to renamed. This is a breaking change.
-rw-r--r--README.markdown6
-rw-r--r--lib/puppet/parser/functions/assert_private.rb (renamed from lib/puppet/parser/functions/private.rb)6
-rwxr-xr-xspec/functions/assert_private_spec.rb (renamed from spec/functions/private_spec.rb)4
3 files changed, 8 insertions, 8 deletions
diff --git a/README.markdown b/README.markdown
index 32d3b18..5adabf7 100644
--- a/README.markdown
+++ b/README.markdown
@@ -363,8 +363,8 @@ returns the value of the resource's parameter. For example, the following code r
* `prefix`: This function applies a prefix to all elements in an array or to the keys in a hash. For example, `prefix(['a','b','c'], 'p')` returns ['pa','pb','pc'], and `prefix({'a'=>'b','b'=>'c','c'=>'d'}, 'p')` returns {'pa'=>'b','pb'=>'c','pc'=>'d'}. *Type*: rvalue
-* `private`: This function sets the current class or definition as private.
-Calling the class or definition from outside the current module will fail. For example, `private()` called in class `foo::bar` outputs the following message if class is called from outside module `foo`:
+* `assert_private`: This function sets the current class or definition as private.
+Calling the class or definition from outside the current module will fail. For example, `assert_private()` called in class `foo::bar` outputs the following message if class is called from outside module `foo`:
```
Class foo::bar is private
@@ -373,7 +373,7 @@ Calling the class or definition from outside the current module will fail. For e
You can specify the error message you want to use:
```
- private("You're not supposed to do that!")
+ assert_private("You're not supposed to do that!")
```
*Type*: statement
diff --git a/lib/puppet/parser/functions/private.rb b/lib/puppet/parser/functions/assert_private.rb
index 60210d3..66c79cc 100644
--- a/lib/puppet/parser/functions/private.rb
+++ b/lib/puppet/parser/functions/assert_private.rb
@@ -1,15 +1,15 @@
#
-# private.rb
+# assert_private.rb
#
module Puppet::Parser::Functions
- newfunction(:private, :doc => <<-'EOS'
+ newfunction(:assert_private, :doc => <<-'EOS'
Sets the current class or definition as private.
Calling the class or definition from outside the current module will fail.
EOS
) do |args|
- raise(Puppet::ParseError, "private(): Wrong number of arguments "+
+ raise(Puppet::ParseError, "assert_private(): Wrong number of arguments "+
"given (#{args.size}}) for 0 or 1)") if args.size > 1
scope = self
diff --git a/spec/functions/private_spec.rb b/spec/functions/assert_private_spec.rb
index c70759f..a009d28 100755
--- a/spec/functions/private_spec.rb
+++ b/spec/functions/assert_private_spec.rb
@@ -1,11 +1,11 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper'
-describe Puppet::Parser::Functions.function(:private) do
+describe Puppet::Parser::Functions.function(:assert_private) do
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
subject do
- function_name = Puppet::Parser::Functions.function(:private)
+ function_name = Puppet::Parser::Functions.function(:assert_private)
scope.method(function_name)
end