Method: PuppetLint::Data.find_resource_param_tokens

Defined in:
lib/puppet-lint/data.rb

.find_resource_param_tokens(resource_tokens) ⇒ Array[PuppetLint::Lexer::Token]

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Find all the Token objects representing the parameter names in a resource definition.

Parameters:

  • resource_tokens (Array[PuppetLint::Lexer::Token])

    An Array of Token objects that comprise the resource definition.

Returns:



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/puppet-lint/data.rb', line 257

def find_resource_param_tokens(resource_tokens)
  param_tokens = []

  iter_token = resource_tokens.first.prev_token

  until iter_token.nil?
    iter_token = iter_token.next_token_of(:NAME)

    break unless resource_tokens.include?(iter_token)

    param_tokens << iter_token if iter_token && iter_token.next_code_token.type == :FARROW
  end

  param_tokens
end