Class: CiscoAclIntp::AcePortOperatorBase
- Inherits:
-
AceSpecBase
- Object
- AccessControlContainer
- AceSpecBase
- CiscoAclIntp::AcePortOperatorBase
- Defined in:
- lib/cisco_acl_intp/acespec_port_opr_base.rb
Overview
TCP/UDP Port Set Operator Class
Direct Known Subclasses
Constant Summary
Constants inherited from AccessControlContainer
CiscoAclIntp::AccessControlContainer::TERM_COLOR_TABLE
Instance Attribute Summary collapse
- #begin_port ⇒ AceProtoSpecBase (also: #port) readonly
- #end_port ⇒ AceProtoSpecBase readonly
- #operator ⇒ Object readonly
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Check equality.
-
#check_any_operator(other) ⇒ Boolean
private
ANY operator check.
-
#contains?(other) ⇒ Boolean
Specified port-set is contained or not?.
-
#contains_any?(_other) ⇒ Boolean
private
Operate ANY containing check.
-
#contains_eq?(_other) ⇒ Boolean
private
Operate EQUAL containing check.
-
#contains_gt?(_other) ⇒ Boolean
private
Operate GREATER_THAN containing check.
-
#contains_lt?(_other) ⇒ Boolean
private
Operate LOWER_THAN containing check.
-
#contains_neq?(_other) ⇒ Boolean
private
Operate NOT_EQUAL containing check.
-
#contains_range?(_other) ⇒ Boolean
private
Operate RANGE containing check.
-
#contains_strict_any?(_other) ⇒ Boolean
private
Operate STRICT_ANY containing check.
-
#initialize(begin_port, end_port = nil) ⇒ AcePortOperatorBase
constructor
Constructor.
-
#to_s ⇒ String
Generate string for Cisco IOS access list.
Methods inherited from AccessControlContainer
#clean_acl_string, disable_color, #generate_tag_footer, #generate_tag_header, #generate_tagged_str, #method_missing
Constructor Details
#initialize(begin_port, end_port = nil) ⇒ AcePortOperatorBase
Constructor
24 25 26 27 28 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 24 def initialize(begin_port, end_port = nil) @operator = :any # default @begin_port = begin_port @end_port = end_port end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CiscoAclIntp::AccessControlContainer
Instance Attribute Details
#begin_port ⇒ AceProtoSpecBase (readonly) Also known as: port
12 13 14 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 12 def begin_port @begin_port end |
#end_port ⇒ AceProtoSpecBase (readonly)
18 19 20 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 18 def end_port @end_port end |
#operator ⇒ Object (readonly)
8 9 10 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 8 def operator @operator end |
Instance Method Details
#==(other) ⇒ Boolean
Check equality
33 34 35 36 37 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 33 def ==(other) @operator == other.operator && @begin_port == other.begin_port && @end_port == other.end_port end |
#check_any_operator(other) ⇒ Boolean (private)
ANY operator check
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 74 def check_any_operator(other) case other when AcePortOpStrictAny # must match before AcePortOpAny (Base Class) contains_strict_any?(other) when AcePortOpAny contains_any?(other) else false # unknown operator end end |
#contains?(other) ⇒ Boolean
Specified port-set is contained or not?
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 52 def contains?(other) case other when AcePortOpEq contains_eq?(other) when AcePortOpNeq contains_neq?(other) when AcePortOpLt contains_lt?(other) when AcePortOpGt contains_gt?(other) when AcePortOpRange contains_range?(other) else check_any_operator(other) end end |
#contains_any?(_other) ⇒ Boolean (private)
Operate ANY containing check
89 90 91 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 89 def contains_any?(_other) false end |
#contains_eq?(_other) ⇒ Boolean (private)
Operate EQUAL containing check
103 104 105 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 103 def contains_eq?(_other) false end |
#contains_gt?(_other) ⇒ Boolean (private)
Operate GREATER_THAN containing check
124 125 126 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 124 def contains_gt?(_other) false end |
#contains_lt?(_other) ⇒ Boolean (private)
Operate LOWER_THAN containing check
117 118 119 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 117 def contains_lt?(_other) false end |
#contains_neq?(_other) ⇒ Boolean (private)
Operate NOT_EQUAL containing check
110 111 112 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 110 def contains_neq?(_other) false end |
#contains_range?(_other) ⇒ Boolean (private)
Operate RANGE containing check
131 132 133 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 131 def contains_range?(_other) false end |
#contains_strict_any?(_other) ⇒ Boolean (private)
Operate STRICT_ANY containing check
96 97 98 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 96 def contains_strict_any?(_other) false end |
#to_s ⇒ String
Generate string for Cisco IOS access list
41 42 43 44 45 46 47 |
# File 'lib/cisco_acl_intp/acespec_port_opr_base.rb', line 41 def to_s tag_port( clean_acl_string( format('%s %s %s', @operator, @begin_port, @end_port) ) ) end |