Method: Tablomat::IPTablesBase::Chain#rule
- Defined in:
- lib/tablomat/iptables/chain.rb
#rule(name, owned = true, &block) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/tablomat/iptables/chain.rb', line 35 def rule(name, owned = true, &block) if name.is_a? Hash name = sethandling(name) if name.key?(:set) name = name.map { |k, v| "--#{k} #{v}" }.join(' ') end key = name.to_s.downcase (@rules[key] || Rule.new(self, name, owned)).tap do |rule| @rules[key] = rule block&.call(rule) end end |