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:



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/puppet-lint/data.rb', line 234

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