]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Rename private() to assert_private()
authorFranz Pletz <fpletz@fnordicwalking.de>
Fri, 19 Dec 2014 11:25:21 +0000 (12:25 +0100)
committerTravis Fields <travis@puppetlabs.com>
Thu, 5 Mar 2015 18:59:31 +0000 (10:59 -0800)
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.

README.markdown
lib/puppet/parser/functions/assert_private.rb [moved from lib/puppet/parser/functions/private.rb with 83% similarity]
spec/functions/assert_private_spec.rb [moved from spec/functions/private_spec.rb with 92% similarity]

index 32d3b1815c4e15690871492c609f0ccaf2c61aac..5adabf74c3a509ca224b147cb4050eb3908a78be 100644 (file)
@@ -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
similarity index 83%
rename from lib/puppet/parser/functions/private.rb
rename to lib/puppet/parser/functions/assert_private.rb
index 60210d335be6b98290a40ac3c31278d6e7464daa..66c79cce34fb7ea295ee2671d85fc7d1a5bf0212 100644 (file)
@@ -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
similarity index 92%
rename from spec/functions/private_spec.rb
rename to spec/functions/assert_private_spec.rb
index c70759fa88582af09ce5187d805c383bd7c1ec3e..a009d28dcb09732d99f6459c53d63cb6242372d9 100755 (executable)
@@ -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