Class: Mt::Wall::Model::Group

Inherits:
Data
  • Object
show all
Defined in:
lib/mt/wall/model/group.rb

Overview

A named collection of AddressObjects and/or other Groups.

RouterOS address-lists are NOT nestable, so groups have no native equivalent: the Compiler FLATTENS a group into the union of its members’ addresses (recursively expanding nested groups). This flattening is the central responsibility of the Compiler.

NOTE: the ‘:members` Data member intentionally shadows Data#members (the auto-generated list of member NAMES). Renaming would break the domain-meaningful public API (`group.members` = the group’s contents), so the Lint/DataDefineOverride warning is suppressed here on purpose.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, members: [], comment: nil) ⇒ Group

Returns a new instance of Group.



21
22
23
# File 'lib/mt/wall/model/group.rb', line 21

def initialize(name:, members: [], comment: nil)
  super(name: name, members: Array(members), comment: comment)
end

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment

Returns:

  • (Object)

    the current value of comment



20
21
22
23
24
# File 'lib/mt/wall/model/group.rb', line 20

Group = Data.define(:name, :members, :comment) do # rubocop:disable Lint/DataDefineOverride
  def initialize(name:, members: [], comment: nil)
    super(name: name, members: Array(members), comment: comment)
  end
end

#membersObject (readonly)

Returns the value of attribute members

Returns:

  • (Object)

    the current value of members



20
21
22
23
24
# File 'lib/mt/wall/model/group.rb', line 20

Group = Data.define(:name, :members, :comment) do # rubocop:disable Lint/DataDefineOverride
  def initialize(name:, members: [], comment: nil)
    super(name: name, members: Array(members), comment: comment)
  end
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



20
21
22
23
24
# File 'lib/mt/wall/model/group.rb', line 20

Group = Data.define(:name, :members, :comment) do # rubocop:disable Lint/DataDefineOverride
  def initialize(name:, members: [], comment: nil)
    super(name: name, members: Array(members), comment: comment)
  end
end