Parent

String

Basic implementation of 'string' % { } like we need it. needs work.

Constants

Percent

Public Instance Methods

%(*a, &b) click to toggle source
# File lib/puppet-lint.rb, line 29
def % *a, &b
  a.flatten!

  string = case a.last
  when Hash
    expand a.pop
  else
    self
  end

  if a.empty?
    string
  else
    Percent.bind(string).call(a, &b)
  end

end
expand(opts = {}) click to toggle source
# File lib/puppet-lint.rb, line 62
def expand opts = {}
  dup.expand! opts
end
expand!(vars = {}) click to toggle source
# File lib/puppet-lint.rb, line 46
def expand! vars = {}
  loop do
    changed = false
    vars.each do |var, value|
      var = var.to_s
      var.gsub! /[^a-zA-Z0-9_]/, ''
      [
        /\%\{#{ var }\}/,
      ].each do |pat|
        changed = gsub! pat, "#{ value }"
      end
    end
    break unless changed
  end
  self
end
prepend(lead) click to toggle source
# File lib/puppet-lint.rb, line 9
def prepend(lead)
  self.replace "#{lead}#{self}"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.