Class: Netfilter::Filter
- Inherits:
-
Object
- Object
- Netfilter::Filter
- Defined in:
- lib/netfilter/filter.rb
Instance Attribute Summary collapse
-
#chain ⇒ Object
Returns the value of attribute chain.
-
#definition ⇒ Object
Returns the value of attribute definition.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #args ⇒ Object
- #export ⇒ Object
-
#initialize(chain, type, definition) ⇒ Filter
constructor
A new instance of Filter.
- #to_s ⇒ Object
Constructor Details
#initialize(chain, type, definition) ⇒ Filter
Returns a new instance of Filter.
14 15 16 17 18 |
# File 'lib/netfilter/filter.rb', line 14 def initialize(chain, type, definition) self.chain = chain self.type = type self.definition = definition end |
Instance Attribute Details
#chain ⇒ Object
Returns the value of attribute chain.
3 4 5 |
# File 'lib/netfilter/filter.rb', line 3 def chain @chain end |
#definition ⇒ Object
Returns the value of attribute definition.
5 6 7 |
# File 'lib/netfilter/filter.rb', line 5 def definition @definition end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/netfilter/filter.rb', line 4 def type @type end |
Class Method Details
.import(chain, data) ⇒ Object
9 10 11 12 |
# File 'lib/netfilter/filter.rb', line 9 def self.import(chain, data) data = data.symbolize_keys new(chain, data[:type], data[:definition]) end |
Instance Method Details
#args ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/netfilter/filter.rb', line 24 def args [].tap do |args| definition.each_pair do |key, value| key = object_to_argument(key) value = object_to_argument(value) value = "#{namespace}-#{value}" if key == "jump" && namespace && !NATIVE_TARGETS.include?(value.downcase) args << "--#{key} #{value}" end end end |
#export ⇒ Object
35 36 37 38 39 40 |
# File 'lib/netfilter/filter.rb', line 35 def export { :type => type, :definition => definition, } end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/netfilter/filter.rb', line 20 def to_s args*" " end |