Module: Conpar::Directive::AccessList

Extended by:
AccessList
Included in:
AccessList
Defined in:
lib/conpar/directive/access_list.rb,
lib/conpar/directive/access_list/base.rb,
lib/conpar/directive/access_list/remark.rb,
lib/conpar/directive/access_list/extended.rb,
lib/conpar/directive/access_list/web_type.rb,
lib/conpar/directive/access_list/standard.rb,
lib/conpar/directive/access_list/ether_type.rb,
lib/conpar/directive/access_list/unknown_type.rb

Overview

Defined Under Namespace

Classes: Base, EtherType, Extended, Remark, Standard, UnknownType, WebType

Constant Summary collapse

SIGNATURE =
Base::SIGNATURE

Instance Method Summary collapse

Instance Method Details

#new(line, options = {}) ⇒ Object


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/conpar/directive/access_list.rb', line 12

def new(line, options={})
  # Shallow ACL Test - Is the line any type of ACL?
  if line =~ SIGNATURE
    # Deeper ACL Testing - Which type of ACL is it?
    [
      Remark,
      Standard,
      WebType,
      EtherType,
      Extended
    ].each do |klass|
      if line =~ klass::SIGNATURE
        return klass.new(line, options)
      end
    end
    # If no match yet, use base ACL type
    return UnknownType.new(line, options)
  end
end