Class: Radiustar::Attribute
- Inherits:
-
Object
- Object
- Radiustar::Attribute
- Includes:
- Radiustar
- Defined in:
- lib/radiustar/dictionary/attributes.rb
Constant Summary
Constants included from Radiustar
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.
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) ⇒ Attribute
constructor
A new instance of Attribute.
- #values ⇒ Object
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
#id ⇒ Object (readonly)
Returns the value of attribute id.
30 31 32 |
# File 'lib/radiustar/dictionary/attributes.rb', line 30 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
30 31 32 |
# File 'lib/radiustar/dictionary/attributes.rb', line 30 def name @name end |
#type ⇒ Object (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
51 52 53 |
# File 'lib/radiustar/dictionary/attributes.rb', line 51 def has_values? !@values.empty? end |
#values ⇒ Object
55 56 57 |
# File 'lib/radiustar/dictionary/attributes.rb', line 55 def values @values end |