Class: Reyes::IPSet
- Inherits:
-
Struct
- Object
- Struct
- Reyes::IPSet
- Defined in:
- lib/reyes/ipset.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#header ⇒ Object
Returns the value of attribute header.
-
#members ⇒ Object
Returns the value of attribute members.
-
#name ⇒ Object
Returns the value of attribute name.
-
#references ⇒ Object
Returns the value of attribute references.
-
#revision ⇒ Object
Returns the value of attribute revision.
-
#size ⇒ Object
Returns the value of attribute size.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
- .load(name) ⇒ Object
-
.load_all ⇒ Object
Loads all IPSets from the local system.
Instance Method Summary collapse
-
#drop! ⇒ Object
Drops the currect IPSet, destroying it on the underlying system.
Instance Attribute Details
#header ⇒ Object
Returns the value of attribute header
57 58 59 |
# File 'lib/reyes/ipset.rb', line 57 def header @header end |
#members ⇒ Object
Returns the value of attribute members
57 58 59 |
# File 'lib/reyes/ipset.rb', line 57 def members @members end |
#name ⇒ Object
Returns the value of attribute name
57 58 59 |
# File 'lib/reyes/ipset.rb', line 57 def name @name end |
#references ⇒ Object
Returns the value of attribute references
57 58 59 |
# File 'lib/reyes/ipset.rb', line 57 def references @references end |
#revision ⇒ Object
Returns the value of attribute revision
57 58 59 |
# File 'lib/reyes/ipset.rb', line 57 def revision @revision end |
#size ⇒ Object
Returns the value of attribute size
57 58 59 |
# File 'lib/reyes/ipset.rb', line 57 def size @size end |
#type ⇒ Object
Returns the value of attribute type
57 58 59 |
# File 'lib/reyes/ipset.rb', line 57 def type @type end |
Class Method Details
.load(name) ⇒ Object
62 63 64 |
# File 'lib/reyes/ipset.rb', line 62 def self.load(name) new(*load_by_name(name)) end |
.load_all ⇒ Object
Loads all IPSets from the local system
68 69 70 71 72 |
# File 'lib/reyes/ipset.rb', line 68 def self.load_all cmd = ['ipset', 'list'] output = Subprocess.check_output(cmd) return output.split("\n\n").map { |x| new(*parse(x)) } end |
Instance Method Details
#drop! ⇒ Object
Drops the currect IPSet, destroying it on the underlying system
75 76 77 78 79 80 81 |
# File 'lib/reyes/ipset.rb', line 75 def drop! begin Subprocess.check_call(["ipset", "destroy", name]) rescue Subprocess::NonZeroExit raise Error.new("Couldn't destroy #{name}") end end |