Class: Radiustar::Attribute
- Inherits:
-
Object
- Object
- Radiustar::Attribute
- Defined in:
- lib/radiustar/dictionary/attributes.rb
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.
Constructor Details
#initialize(name, id, type) ⇒ Attribute
Returns a new instance of Attribute.
29 30 31 32 33 34 |
# File 'lib/radiustar/dictionary/attributes.rb', line 29 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.
27 28 29 |
# File 'lib/radiustar/dictionary/attributes.rb', line 27 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
27 28 29 |
# File 'lib/radiustar/dictionary/attributes.rb', line 27 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
27 28 29 |
# File 'lib/radiustar/dictionary/attributes.rb', line 27 def type @type end |
Instance Method Details
#add_value(name, id) ⇒ Object
36 37 38 |
# File 'lib/radiustar/dictionary/attributes.rb', line 36 def add_value(name, id) @values.add(name, id.to_i) end |
#find_values_by_id(id) ⇒ Object
44 45 46 |
# File 'lib/radiustar/dictionary/attributes.rb', line 44 def find_values_by_id(id) @values.find_by_id(id.to_i) end |
#find_values_by_name(name) ⇒ Object
40 41 42 |
# File 'lib/radiustar/dictionary/attributes.rb', line 40 def find_values_by_name(name) @values.find_by_name(name) end |
#has_values? ⇒ Boolean
48 49 50 |
# File 'lib/radiustar/dictionary/attributes.rb', line 48 def has_values? !@values.empty? end |