class Tablomat::IPSet::Entry
interface to manage the entrys inside the sets
Public Class Methods
new(set, description)
click to toggle source
# File lib/tablomat/ipset/entry.rb, line 7 def initialize(set, description) @system = set.system @set = set @description = description end
Public Instance Methods
add(add_options, exist = false)
click to toggle source
# File lib/tablomat/ipset/entry.rb, line 25 def add(add_options, exist = false) command = "#{@system.ipset_bin} add #{@set.name} #{@description} #{add_options}" command = "#{command} -!" if exist @system.exec command end
del(exist = false)
click to toggle source
# File lib/tablomat/ipset/entry.rb, line 31 def del(exist = false) command = "#{@system.ipset_bin} del #{@set.name} #{@description}" command = "#{command} -!" if exist @system.exec command end
exists?()
click to toggle source
# File lib/tablomat/ipset/entry.rb, line 13 def exists? command = "#{@system.ipset_bin} del #{@set.name} #{@description}" @system.exec command command = "#{@system.ipset_bin} add #{@set.name} #{@description}" @system.exec command true rescue IPSetError => e raise unless e.message.include?("Element cannot be deleted from the set: it's not added") false end