Class: Radiustar::Attribute

Inherits:
Object
  • Object
show all
Includes:
Radiustar
Defined in:
lib/radiustar/dictionary/attributes.rb

Constant Summary

Constants included from Radiustar

LIBPATH, PATH

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Radiustar

#inspect, libpath, path, require_all_libs_relative_to, version

Constructor Details

#initialize(name, id, type) ⇒ Attribute

Returns a new instance of Attribute.



32
33
34
35
36
37
# File 'lib/radiustar/dictionary/attributes.rb', line 32

def initialize(name, id, type)
  @values = ValuesCollection.new
  @name = name
  @id = id.to_i
  @type = type
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



30
31
32
# File 'lib/radiustar/dictionary/attributes.rb', line 30

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



30
31
32
# File 'lib/radiustar/dictionary/attributes.rb', line 30

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



30
31
32
# File 'lib/radiustar/dictionary/attributes.rb', line 30

def type
  @type
end

Instance Method Details

#add_value(name, id) ⇒ Object



39
40
41
# File 'lib/radiustar/dictionary/attributes.rb', line 39

def add_value(name, id)
  @values.add(name, id.to_i)
end

#find_values_by_id(id) ⇒ Object



47
48
49
# File 'lib/radiustar/dictionary/attributes.rb', line 47

def find_values_by_id(id)
  @values.find_by_id(id.to_i)
end

#find_values_by_name(name) ⇒ Object



43
44
45
# File 'lib/radiustar/dictionary/attributes.rb', line 43

def find_values_by_name(name)
  @values.find_by_name(name)
end

#has_values?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/radiustar/dictionary/attributes.rb', line 51

def has_values?
  !@values.empty?
end

#valuesObject



55
56
57
# File 'lib/radiustar/dictionary/attributes.rb', line 55

def values
  @values
end