Class: CiscoAclIntp::EvaluateAce

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

Overview

Evaluate 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(opts) ⇒ EvaluateAce

Constructor

Parameters:

  • opts (Hash)

    Options

Options Hash (opts):

  • :number (Integer)

    Sequence number

  • :recursive_name (String)

    Recursive entry name

Raises:



110
111
112
113
114
# File 'lib/cisco_acl_intp/ace_base.rb', line 110

def initialize(opts)
  super
  @options = opts
  @recursive_name = define_recursive_name
end

Dynamic Method Handling

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

Instance Attribute Details

#recursive_nameString

Parameters:

  • value (String)

    Recutsive entry name

Returns:

  • (String)


102
103
104
# File 'lib/cisco_acl_intp/ace_base.rb', line 102

def recursive_name
  @recursive_name
end

Instance Method Details

#==(other) ⇒ Boolean

Returns Compare with recursive entry name.

Returns:

  • (Boolean)

    Compare with recursive entry name



128
129
130
131
# File 'lib/cisco_acl_intp/ace_base.rb', line 128

def ==(other)
  other.instance_of?(EvaluateAce) &&
    @recursive_name == other.recursive_name
end

#contains?(_opts = nil) ⇒ Boolean

TODO:

for Recursive name matching is not implemented yet

Search matched ACE return [Boolean]

Parameters:

  • _opts (Hash) (defaults to: nil)

    Options

Returns:

  • (Boolean)


143
144
145
# File 'lib/cisco_acl_intp/ace_base.rb', line 143

def contains?(_opts = nil)
  false
end

#define_recursive_nameObject

Set instance variables return [String] Recursive entry name raise [AclArgumentError]



119
120
121
122
123
124
125
# File 'lib/cisco_acl_intp/ace_base.rb', line 119

def define_recursive_name
  if @options.key?(:recursive_name)
    @options[:recursive_name]
  else
    raise AclArgumentError, 'name not specified'
  end
end

#to_sString

Generate string for Cisco IOS access list

Returns:

  • (String)


135
136
137
# File 'lib/cisco_acl_intp/ace_base.rb', line 135

def to_s
  format 'evaluate %s', tag_name(@recursive_name)
end