class Hieracles::Format
Public Class Methods
new(node)
click to toggle source
# File lib/hieracles/format.rb, line 3 def initialize(node) @node = node end
Public Instance Methods
allparams(args)
click to toggle source
# File lib/hieracles/format.rb, line 27 def allparams(args) show_params(false, args) end
facts(_)
click to toggle source
# File lib/hieracles/format.rb, line 11 def facts(_) "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n" end
files(_)
click to toggle source
# File lib/hieracles/format.rb, line 15 def files(_) "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n" end
info(_)
click to toggle source
# File lib/hieracles/format.rb, line 7 def info(_) "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n" end
modules(args)
click to toggle source
# File lib/hieracles/format.rb, line 40 def modules(args) output = '' @node.modules.each do |k, v| output << build_modules_line(k, v) end output end
params(args)
click to toggle source
# File lib/hieracles/format.rb, line 23 def params(args) show_params(true, args) end
paths(_)
click to toggle source
# File lib/hieracles/format.rb, line 19 def paths(_) "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n" end
show_params(without_common, args)
click to toggle source
# File lib/hieracles/format.rb, line 31 def show_params(without_common, args) filter = args[0] output = build_head(without_common) @node.params(without_common).each do |k, v| output << build_params_line(k, v, filter) end output end
Protected Instance Methods
build_head(without_common)
click to toggle source
# File lib/hieracles/format.rb, line 50 def build_head(without_common) "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n" end
build_modules_line(key, value)
click to toggle source
# File lib/hieracles/format.rb, line 58 def build_modules_line(key, value) "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n" end
build_params_line(key, value, filter)
click to toggle source
# File lib/hieracles/format.rb, line 54 def build_params_line(key, value, filter) "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n" end
is_merged?(v)
click to toggle source
# File lib/hieracles/format.rb, line 62 def is_merged?(v) v[:value].is_a?(Array) && (v[:value] | v[:merged]) != v[:value] end
sanitize(v)
click to toggle source
# File lib/hieracles/format.rb, line 66 def sanitize(v) v.to_s.gsub('%', '%%') end