Sha256: 670a366c97c58f81eae98b28ed34a88b3b3ffcbff65847487bd38f425c725a84
Contents?: true
Size: 901 Bytes
Versions: 2
Compression:
Stored size: 901 Bytes
Contents
require 'json/ext' module Hieracles module Formats # format intended to be used for an api server class Json < Hieracles::Format def info(_) @node.info.merge(alerts).to_json end def facts(_) @node.facts.merge(alerts).to_json end def files(_) { 'files' => @node.files }.merge(alerts).to_json end def paths(_) { 'paths' => @node.paths }.merge(alerts).to_json end def modules(_) @node.modules.merge(alerts).to_json end def params(args) @node.params(true).merge(alerts).to_json end def allparams(args) @node.params(false).merge(alerts).to_json end private def alerts if @node.notifications.count > 0 { 'alerts' => @node.notifications.map(&:to_hash) } else {} end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hieracles-0.2.2 | lib/hieracles/formats/json.rb |
hieracles-0.2.1 | lib/hieracles/formats/json.rb |