Class: CiscoAclIntp::AcePortOpRange
- Inherits:
-
AcePortOperatorBase
- Object
- AccessControlContainer
- AceSpecBase
- AcePortOperatorBase
- CiscoAclIntp::AcePortOpRange
- Defined in:
- lib/cisco_acl_intp/acespec_port_opr.rb
Overview
RANGE operator class
Constant Summary
Constants inherited from AccessControlContainer
CiscoAclIntp::AccessControlContainer::TERM_COLOR_TABLE
Instance Attribute Summary
Attributes inherited from AcePortOperatorBase
#begin_port, #end_port, #operator
Instance Method Summary collapse
-
#contains_any?(_other) ⇒ Boolean
private
RANGE contains ANY?.
-
#contains_eq?(other) ⇒ Boolean
private
RANGE contains EQ?.
-
#contains_gt?(other) ⇒ Boolean
private
RANGE contains GT?.
-
#contains_lt?(other) ⇒ Boolean
private
RANGE contains LT?.
-
#contains_neq?(other) ⇒ Boolean
private
RANGE contains NEQ?.
-
#contains_range?(other) ⇒ Boolean
private
RANGE contains RANGE?.
-
#initialize(*args) ⇒ AcePortOpRange
constructor
Constructor.
Methods inherited from AcePortOperatorBase
#==, #check_any_operator, #contains?, #contains_strict_any?, #to_s
Methods inherited from AccessControlContainer
#clean_acl_string, disable_color, #generate_tag_footer, #generate_tag_header, #generate_tagged_str, #method_missing, #to_s
Constructor Details
#initialize(*args) ⇒ AcePortOpRange
Constructor
193 194 195 196 197 198 199 |
# File 'lib/cisco_acl_intp/acespec_port_opr.rb', line 193 def initialize(*args) super unless @begin_port < @end_port raise AclArgumentError, 'Invalid port sequence' end @operator = :range end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CiscoAclIntp::AccessControlContainer
Instance Method Details
#contains_any?(_other) ⇒ Boolean (private)
RANGE contains ANY?
206 207 208 |
# File 'lib/cisco_acl_intp/acespec_port_opr.rb', line 206 def contains_any?(_other) @begin_port.min? && @end_port.max? end |
#contains_eq?(other) ⇒ Boolean (private)
RANGE contains EQ?
213 214 215 |
# File 'lib/cisco_acl_intp/acespec_port_opr.rb', line 213 def contains_eq?(other) @begin_port <= other.port && other.port <= @end_port end |
#contains_gt?(other) ⇒ Boolean (private)
RANGE contains GT?
235 236 237 |
# File 'lib/cisco_acl_intp/acespec_port_opr.rb', line 235 def contains_gt?(other) @begin_port < other.port && @end_port.max? end |
#contains_lt?(other) ⇒ Boolean (private)
RANGE contains LT?
228 229 230 |
# File 'lib/cisco_acl_intp/acespec_port_opr.rb', line 228 def contains_lt?(other) @begin_port.min? && other.port < @end_port end |
#contains_neq?(other) ⇒ Boolean (private)
RANGE contains NEQ?
220 221 222 223 |
# File 'lib/cisco_acl_intp/acespec_port_opr.rb', line 220 def contains_neq?(other) @begin_port.min? && @end_port.max? && (other.port.min? || other.port.max?) end |
#contains_range?(other) ⇒ Boolean (private)
RANGE contains RANGE?
242 243 244 245 |
# File 'lib/cisco_acl_intp/acespec_port_opr.rb', line 242 def contains_range?(other) @begin_port <= other.begin_port && other.end_port <= @end_port end |