class Puppet::Pops::Issues::MessageData

Provides a binding of arguments passed to Puppet::Pops::Issues::Issue#format to method names available in the issue’s message producing block. @api private

Public Class Methods

new(*argnames) click to toggle source
# File lib/puppet/pops/issues.rb, line 62
def initialize *argnames
  singleton = class << self; self end
  argnames.each do |name|
    singleton.send(:define_method, name) do
      @data[name]
    end
  end
end

Public Instance Methods

format(hash, &block) click to toggle source
# File lib/puppet/pops/issues.rb, line 71
def format(hash, &block)
  @data = hash
  instance_eval &block
end
label(it = nil) click to toggle source

Returns the label provider given as a key in the hash passed to format. If given an argument, calls label on the label provider (caller would otherwise have to call label.label(it)

# File lib/puppet/pops/issues.rb, line 80
def label(it = nil)
  raise "Label provider key :label must be set to produce the text of the message!" unless @data[:label]
  it.nil? ? @data[:label] : @data[:label].label(it)
end
semantic() click to toggle source

Returns the label provider given as a key in the hash passed to format.

# File lib/puppet/pops/issues.rb, line 87
def semantic
  raise "Label provider key :semantic must be set to produce the text of the message!" unless @data[:semantic]
  @data[:semantic]
end