Class: HWAddr::Database::Company
- Inherits:
-
Object
- Object
- HWAddr::Database::Company
- Includes:
- Enumerable
- Defined in:
- lib/hwaddr/database.rb
Defined Under Namespace
Classes: Range
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #===(other) ⇒ Object (also: #include?, #member?, #cover?)
- #add(range, address = nil) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(name, entries = nil) ⇒ Company
constructor
A new instance of Company.
Constructor Details
#initialize(name, entries = nil) ⇒ Company
Returns a new instance of Company.
37 38 39 40 |
# File 'lib/hwaddr/database.rb', line 37 def initialize (name, entries = nil) @name = name @entries = entries || [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
35 36 37 |
# File 'lib/hwaddr/database.rb', line 35 def name @name end |
Instance Method Details
#===(other) ⇒ Object Also known as: include?, member?, cover?
46 47 48 |
# File 'lib/hwaddr/database.rb', line 46 def === (other) any? { |r| r =~ other } end |
#add(range, address = nil) ⇒ Object
42 43 44 |
# File 'lib/hwaddr/database.rb', line 42 def add (range, address = nil) @entries << Range.new(self, range, address) end |
#each(&block) ⇒ Object
54 55 56 |
# File 'lib/hwaddr/database.rb', line 54 def each (&block) @entries.each(&block) end |