From: Jacob Helwig Date: Mon, 25 Jun 2018 18:21:24 +0000 (-0700) Subject: Remove Rubocop Performance/Caller violation X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=0c845b50fba49390189b147eaf3269c078045c36;p=puppet-sshkeys_core.git Remove Rubocop Performance/Caller violation Turns out that using `caller(n..n).first` is _significantly_ faster than `caller[n]`. --- 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?