Class: RadiusRB::Attribute
- Inherits:
-
Object
- Object
- RadiusRB::Attribute
- Includes:
- RadiusRB
- Defined in:
- lib/radiusrb/dictionary/attributes.rb
Constant Summary
Constants included from RadiusRB
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#vendor ⇒ Object
readonly
Returns the value of attribute vendor.
Instance Method Summary collapse
- #add_value(name, id) ⇒ Object
- #find_values_by_id(id) ⇒ Object
- #find_values_by_name(name) ⇒ Object
- #has_values? ⇒ Boolean
-
#initialize(name, id, type, vendor = nil) ⇒ Attribute
constructor
A new instance of Attribute.
- #values ⇒ Object
- #vendor? ⇒ Boolean
Methods included from RadiusRB
libpath, path, require_all_libs_relative_to
Constructor Details
#initialize(name, id, type, vendor = nil) ⇒ Attribute
Returns a new instance of Attribute.
43 44 45 46 47 48 49 |
# File 'lib/radiusrb/dictionary/attributes.rb', line 43 def initialize(name, id, type, vendor=nil) @values = ValuesCollection.new @name = name @id = id.to_i @type = type @vendor = vendor if vendor end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
41 42 43 |
# File 'lib/radiusrb/dictionary/attributes.rb', line 41 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
41 42 43 |
# File 'lib/radiusrb/dictionary/attributes.rb', line 41 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
41 42 43 |
# File 'lib/radiusrb/dictionary/attributes.rb', line 41 def type @type end |
#vendor ⇒ Object (readonly)
Returns the value of attribute vendor.
41 42 43 |
# File 'lib/radiusrb/dictionary/attributes.rb', line 41 def vendor @vendor end |
Instance Method Details
#add_value(name, id) ⇒ Object
51 52 53 |
# File 'lib/radiusrb/dictionary/attributes.rb', line 51 def add_value(name, id) @values.add(name, id.to_i) end |
#find_values_by_id(id) ⇒ Object
59 60 61 |
# File 'lib/radiusrb/dictionary/attributes.rb', line 59 def find_values_by_id(id) @values.find_by_id(id.to_i) end |
#find_values_by_name(name) ⇒ Object
55 56 57 |
# File 'lib/radiusrb/dictionary/attributes.rb', line 55 def find_values_by_name(name) @values.find_by_name(name) end |
#has_values? ⇒ Boolean
63 64 65 |
# File 'lib/radiusrb/dictionary/attributes.rb', line 63 def has_values? !@values.empty? end |
#values ⇒ Object
67 68 69 |
# File 'lib/radiusrb/dictionary/attributes.rb', line 67 def values @values end |
#vendor? ⇒ Boolean
71 72 73 |
# File 'lib/radiusrb/dictionary/attributes.rb', line 71 def vendor? !!@vendor end |