class Puffy::Formatters::Base::Ruleset
Public Class Methods
new()
click to toggle source
# File lib/puffy/formatters/base.rb, line 29 def initialize @rule_formatter = Class.const_get(self.class.name.sub(/set$/, '')).new end
Public Instance Methods
emit_header()
click to toggle source
# File lib/puffy/formatters/base.rb, line 33 def emit_header ["# Generated by puffy v#{Puffy::VERSION} on #{Time.now.strftime('%c')}"] end
emit_ruleset(rules, _policy = nil)
click to toggle source
Returns a String representation of the provided rules
Array
of Puffy::Rule
with the policy
policy.
@param rules [Array<Puffy::Rule>] array of Puffy::Rule
. @param _policy [Symbol] ruleset policy. @return [String]
# File lib/puffy/formatters/base.rb, line 42 def emit_ruleset(rules, _policy = nil) rules.collect { |rule| @rule_formatter.emit_rule(rule) }.join("\n") end
filename_fragment()
click to toggle source
Filename for a firewall configuration fragment emitted by the formatter.
@return [Array<String>]
# File lib/puffy/formatters/base.rb, line 49 def filename_fragment raise 'Formatters#filename_fragment MUST be overriden' end