class RadiusRB::AttributesCollection

Attributes

vendor[RW]

Public Class Methods

new(vendor=nil) click to toggle source
# File lib/radiusrb/dictionary/attributes.rb, line 7
def initialize vendor=nil
  @collection = {}
  @revcollection = {}
  @vendor = vendor if vendor
end

Public Instance Methods

add(name, id, type) click to toggle source
# File lib/radiusrb/dictionary/attributes.rb, line 13
def add(name, id, type)
  if vendor?
    @collection[name] ||= Attribute.new(name, id.to_i, type, @vendor)
  else
    @collection[name] ||= Attribute.new(name, id.to_i, type)
  end
  @revcollection[id.to_i] ||= @collection[name]
  self << @collection[name]
end
find_by_id(id) click to toggle source
# File lib/radiusrb/dictionary/attributes.rb, line 27
def find_by_id(id)
  @revcollection[id]
end
find_by_name(name) click to toggle source
# File lib/radiusrb/dictionary/attributes.rb, line 23
def find_by_name(name)
  @collection[name]
end
vendor?() click to toggle source
# File lib/radiusrb/dictionary/attributes.rb, line 31
def vendor?
  !!@vendor
end