Module: PuppetStrings::Yard::Util

Defined in:
lib/puppet-strings/yard/util.rb

Overview

The module for various puppet-strings utility helpers.

Class Method Summary collapse

Class Method Details

.scrub_string(str) ⇒ String

Trims indentation from trailing whitespace and removes ruby literal quotation syntax ‘%Q{}` and `%q` from parsed strings.

Parameters:

  • str (String)

    The string to scrub.

Returns:

  • (String)

    A scrubbed string.



9
10
11
12
13
14
15
16
# File 'lib/puppet-strings/yard/util.rb', line 9

def self.scrub_string(str)
  match = str.match(/^%[Qq]{(.*)}$/m)
  if match
    return Puppet::Util::Docs.scrub(match[1])
  end

  Puppet::Util::Docs.scrub(str)
end