Class: RadiusRB::ValuesCollection

Inherits:
Array
  • Object
show all
Defined in:
lib/radiusrb/dictionary/values.rb

Instance Method Summary collapse

Constructor Details

#initializeValuesCollection

Returns a new instance of ValuesCollection.



5
6
7
8
# File 'lib/radiusrb/dictionary/values.rb', line 5

def initialize
  @collection = {}
  @revcollection = {}
end

Instance Method Details

#add(name, id) ⇒ Object



10
11
12
13
14
# File 'lib/radiusrb/dictionary/values.rb', line 10

def add(name, id)
  @collection[name] ||= Value.new(name, id)
  @revcollection[id.to_i] ||= @collection[name]
  self << @collection[name]
end

#empty?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/radiusrb/dictionary/values.rb', line 24

def empty?
  @collection.empty?
end

#find_by_id(id) ⇒ Object



20
21
22
# File 'lib/radiusrb/dictionary/values.rb', line 20

def find_by_id(id)
  @revcollection[id]
end

#find_by_name(name) ⇒ Object



16
17
18
# File 'lib/radiusrb/dictionary/values.rb', line 16

def find_by_name(name)
  @collection[name]
end