Class: HWAddr::Database::Company

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/hwaddr/database.rb

Defined Under Namespace

Classes: Range

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (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