Use native to_line methods which is more easily testable
This commit is contained in:
@@ -23,12 +23,10 @@ Puppet::Type.type(:entropy_mask).provide(:parsed,
|
||||
record_line :parsed,
|
||||
:fields => %w{operator package version slot use tag repo name},
|
||||
:match => %r{^([<>]?=)?([a-zA-Z+\/-]*)(?:-(\d+(?:\.\d+)*[a-z]*(?:_(?:alpha|beta|pre|p|rc)\d*)?(?:-r\d+)?))?(?::([a-zA-Z0-9._-]+))?(?:\[([^\]]*)\])?(?:#([a-zA-Z0-9._-]+))?(?:::([a-zA-Z0-9\._-]+))?\s+#+ Puppet Name: (.*)\s*$},
|
||||
:block_eval => :instance do
|
||||
|
||||
def to_line(record)
|
||||
:to_line => proc { |record|
|
||||
line = ""
|
||||
line += record[:operator] if record[:operator]
|
||||
line += record[:package]
|
||||
line += record[:package] if record[:package]
|
||||
line += "-" + record[:version] if record[:version]
|
||||
line += ":" + record[:slot] if record[:slot]
|
||||
line += "[" + record[:use] + "]" if record[:use]
|
||||
@@ -37,10 +35,8 @@ Puppet::Type.type(:entropy_mask).provide(:parsed,
|
||||
line += " ## Puppet Name: " + record[:name]
|
||||
|
||||
line
|
||||
end
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# vim: set ts=2 shiftwidth=2 expandtab :
|
||||
|
||||
Reference in New Issue
Block a user