Class: CiscoAclIntp::AceBase
- Inherits:
-
AccessControlContainer
- Object
- AccessControlContainer
- CiscoAclIntp::AceBase
- Includes:
- Comparable
- Defined in:
- lib/cisco_acl_intp/ace_base.rb
Overview
AceBase: Base class of ACE(Access Control Entry). ACE is composed of each types of AceSpecs.
Direct Known Subclasses
Constant Summary collapse
- NO_SEQ_NUMBER =
Number used when ACE does not has sequence number
-1
Constants inherited from AccessControlContainer
CiscoAclIntp::AccessControlContainer::TERM_COLOR_TABLE
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Compare by sequence number.
-
#contains? ⇒ Boolean
abstract
Search matched ACE.
-
#initialize(opts) ⇒ AceBase
constructor
Constructor.
-
#seq_number? ⇒ Boolean
Check this object has sequence number.
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(opts) ⇒ AceBase
Constructor
21 22 23 |
# File 'lib/cisco_acl_intp/ace_base.rb', line 21 def initialize(opts) @seq_number = opts[:number] || NO_SEQ_NUMBER end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CiscoAclIntp::AccessControlContainer
Instance Attribute Details
#seq_number ⇒ Integer
12 13 14 |
# File 'lib/cisco_acl_intp/ace_base.rb', line 12 def seq_number @seq_number end |
Instance Method Details
#<=>(other) ⇒ Integer
Using “Comparable” module, ‘==’ operator is defined by ‘<=>’ operator. But ACE object will be compared by its value (comparison by the equivalence), instead of sequence number. The ‘==’ operator will be overriden in child class.
Compare by sequence number
38 39 40 |
# File 'lib/cisco_acl_intp/ace_base.rb', line 38 def <=>(other) @seq_number <=> other.seq_number end |
#contains? ⇒ Boolean
Search matched ACE
45 46 47 |
# File 'lib/cisco_acl_intp/ace_base.rb', line 45 def contains? false end |
#seq_number? ⇒ Boolean
Check this object has sequence number
27 28 29 |
# File 'lib/cisco_acl_intp/ace_base.rb', line 27 def seq_number? @seq_number > NO_SEQ_NUMBER end |