Class: CiscoAclIntp::AceTcpFlagList

Inherits:
AceSpecBase show all
Extended by:
Forwardable
Defined in:
lib/cisco_acl_intp/acespec_tcp_flags.rb

Overview

TCP flag list container

Constant Summary

Constants inherited from AccessControlContainer

CiscoAclIntp::AccessControlContainer::TERM_COLOR_TABLE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AccessControlContainer

#clean_acl_string, disable_color, #generate_tag_footer, #generate_tag_header, #generate_tagged_str, #method_missing

Constructor Details

#initialize(list = []) ⇒ AceTcpFlagList

TODO:

If the object that are same are included in the list?

Constructor

Parameters:

  • list (Array<AceTcpFlag>) (defaults to: [])

    TCP Flag Objects



46
47
48
# File 'lib/cisco_acl_intp/acespec_tcp_flags.rb', line 46

def initialize(list = [])
  @list = list
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CiscoAclIntp::AccessControlContainer

Instance Attribute Details

#listArray

Parameters:

  • value (Array)

    TCP Flags

Returns:

  • (Array)


39
40
41
# File 'lib/cisco_acl_intp/acespec_tcp_flags.rb', line 39

def list
  @list
end

Instance Method Details

#==(other) ⇒ Boolean

Note:

Checked each entry in randum order.

Parameters:

Returns:

  • (Boolean)


59
60
61
62
63
# File 'lib/cisco_acl_intp/acespec_tcp_flags.rb', line 59

def ==(other)
  @list.reduce(true) do |res, each|
    res && other.list.include?(each)
  end
end

#to_sString

Generate string for Cisco IOS access list

Returns:

  • (String)


52
53
54
# File 'lib/cisco_acl_intp/acespec_tcp_flags.rb', line 52

def to_s
  tag_port(@list.map(&:to_s).join(' '))
end