Class: CiscoAclIntp::RemarkAce

Inherits:
AceBase show all
Defined in:
lib/cisco_acl_intp/ace_base.rb

Overview

Remark entry container

Constant Summary

Constants inherited from AceBase

AceBase::NO_SEQ_NUMBER

Constants inherited from AccessControlContainer

AccessControlContainer::TERM_COLOR_TABLE

Instance Attribute Summary collapse

Attributes inherited from AceBase

#seq_number

Instance Method Summary collapse

Methods inherited from AceBase

#<=>, #seq_number?

Methods inherited from AccessControlContainer

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

Constructor Details

#initialize(str) ⇒ RemarkAce

Constructor

Parameters:

  • str (String)

    Comment string



73
74
75
76
# File 'lib/cisco_acl_intp/ace_base.rb', line 73

def initialize(str)
  @comment = str.strip
  @seq_number = NO_SEQ_NUMBER # remark does not takes line number
end

Dynamic Method Handling

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

Instance Attribute Details

#commentString

Parameters:

  • value (String)

    Comment string

Returns:

  • (String)


68
69
70
# File 'lib/cisco_acl_intp/ace_base.rb', line 68

def comment
  @comment
end

Instance Method Details

#==(other) ⇒ Boolean

Check equality

Returns:

  • (Boolean)

    Compare with comment string



80
81
82
# File 'lib/cisco_acl_intp/ace_base.rb', line 80

def ==(other)
  other.instance_of?(RemarkAce) && @comment == other.comment
end

#contains?(_opts = nil) ⇒ Boolean

Search matched ACE return [Boolean] false, Remark does not match anithyng.

Parameters:

  • _opts (Hash) (defaults to: nil)

    Options

Returns:

  • (Boolean)


93
94
95
# File 'lib/cisco_acl_intp/ace_base.rb', line 93

def contains?(_opts = nil)
  false
end

#to_sString

Generate string for Cisco IOS access list

Returns:

  • (String)

    Comment string



86
87
88
# File 'lib/cisco_acl_intp/ace_base.rb', line 86

def to_s
  format 'remark %s', tag_remark(@comment.to_s)
end