Class: Brocade::SAN::Zone
- Inherits:
-
Object
- Object
- Brocade::SAN::Zone
- Defined in:
- lib/brocadesan/zone.rb
Overview
Zone model
Constant Summary collapse
- MEMBER_RULE =
member naming rule member can be anything that match Switch::NAME_RULE or WWN or Domain,Index port notation allowed examples:
50:00:10:20:30:40:50:60
2,61
alias_test_3
'([\da-f]{2}:){7}[\da-f]{2}|\d{1,3},\d{1,3}|' << Switch::NAME_RULE
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
true if zone is active / member of effective ZoneConfiguration.
-
#name ⇒ Object
readonly
returns name of the zone.
Class Method Summary collapse
-
.verify_member_name(str) ⇒ Object
verifies if
str
matches convetion defined in Zone::MEMBER_RULE raises Switch::Error: Incorrect name format if not this method is used internally mostly.
Instance Method Summary collapse
-
#add_member(member) ⇒ Object
add member to the object members of zones are aliases, wwns or D,I notation
member
is name of the member. -
#initialize(name, opts = {}) ⇒ Zone
constructor
init method.
-
#members ⇒ Object
returns array of members.
- #to_s ⇒ Object
Constructor Details
#initialize(name, opts = {}) ⇒ Zone
init method
33 34 35 36 37 38 |
# File 'lib/brocadesan/zone.rb', line 33 def initialize(name,opts={}) # :nodoc: Switch::verify_name(name) @name=name @active=opts[:active].nil? ? false : opts[:active] @members=[] end |
Instance Attribute Details
#active ⇒ Object (readonly)
true if zone is active / member of effective ZoneConfiguration
9 10 11 |
# File 'lib/brocadesan/zone.rb', line 9 def active @active end |
#name ⇒ Object (readonly)
returns name of the zone
6 7 8 |
# File 'lib/brocadesan/zone.rb', line 6 def name @name end |
Class Method Details
.verify_member_name(str) ⇒ Object
verifies if str
matches convetion defined in Zone::MEMBER_RULE raises Switch::Error: Incorrect name format if not this method is used internally mostly
28 29 30 |
# File 'lib/brocadesan/zone.rb', line 28 def self.verify_member_name(str) raise Switch::Error.incorrect("#{str}") if !str.match(/#{MEMBER_RULE}/i) end |
Instance Method Details
#add_member(member) ⇒ Object
add member to the object members of zones are aliases, wwns or D,I notation member
is name of the member
49 50 51 52 |
# File 'lib/brocadesan/zone.rb', line 49 def add_member(member) Zone::verify_member_name(member) @members<<member end |
#members ⇒ Object
returns array of members
42 43 44 |
# File 'lib/brocadesan/zone.rb', line 42 def members @members end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/brocadesan/zone.rb', line 54 def to_s @name end |