aboutsummaryrefslogtreecommitdiff
path: root/spec/lib/puppet_spec
diff options
context:
space:
mode:
authorJacob Helwig <jacob@technosorcery.net>2018-06-25 11:21:24 -0700
committerJacob Helwig <jacob@technosorcery.net>2018-06-25 11:26:53 -0700
commit0c845b50fba49390189b147eaf3269c078045c36 (patch)
tree24b8f8e0f684407d76e894816a90357169d5586c /spec/lib/puppet_spec
parent47e0571aace7e8222eb6f07ffe35419e07b6a491 (diff)
downloadpuppet-sshkeys_core-0c845b50fba49390189b147eaf3269c078045c36.tar.gz
puppet-sshkeys_core-0c845b50fba49390189b147eaf3269c078045c36.tar.bz2
Remove Rubocop Performance/Caller violation
Turns out that using `caller(n..n).first` is _significantly_ faster than `caller[n]`.
Diffstat (limited to 'spec/lib/puppet_spec')
-rw-r--r--spec/lib/puppet_spec/compiler.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/lib/puppet_spec/compiler.rb b/spec/lib/puppet_spec/compiler.rb
index c3d33a5..49a6534 100644
--- a/spec/lib/puppet_spec/compiler.rb
+++ b/spec/lib/puppet_spec/compiler.rb
@@ -90,7 +90,7 @@ module PuppetSpec::Compiler
# (Parameters given by name)
#
def evaluate(code: 'undef', source: nil, node: Puppet::Node.new('testnode'), variables: {})
- source_location = caller[0]
+ source_location = caller(0..0).first
Puppet[:code] = code
compiler = Puppet::Parser::Compiler.new(node)
unless variables.empty?