Class: Radiustar::Dictionary
- Inherits:
-
Object
- Object
- Radiustar::Dictionary
show all
- Includes:
- Radiustar
- Defined in:
- lib/radiustar/dictionary.rb
Constant Summary
collapse
- DEFAULT_DICTIONARIES_PATH =
::File.join(::File.dirname(__FILE__), '..', '..', 'templates')
Constants included
from Radiustar
LIBPATH, PATH
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Radiustar
#inspect, libpath, path, require_all_libs_relative_to, version
Constructor Details
#initialize(initial_path = nil) ⇒ Dictionary
Returns a new instance of Dictionary.
9
10
11
12
13
14
|
# File 'lib/radiustar/dictionary.rb', line 9
def initialize(initial_path = nil)
@attributes = AttributesCollection.new
@vendors = VendorCollection.new
read_files initial_path if initial_path
end
|
Instance Method Details
#attribute_id_defined?(id) ⇒ Boolean
38
39
40
|
# File 'lib/radiustar/dictionary.rb', line 38
def attribute_id_defined?(id)
!@attributes.find_by_id(id).nil?
end
|
#attribute_name_defined?(name) ⇒ Boolean
34
35
36
|
# File 'lib/radiustar/dictionary.rb', line 34
def attribute_name_defined?(name)
!@attributes.find_by_name(name).nil?
end
|
#attributes ⇒ Object
46
47
48
|
# File 'lib/radiustar/dictionary.rb', line 46
def attributes
@attributes
end
|
#find_attribute_by_id(id) ⇒ Object
30
31
32
|
# File 'lib/radiustar/dictionary.rb', line 30
def find_attribute_by_id(id)
@attributes.find_by_id(id)
end
|
#find_attribute_by_name(name) ⇒ Object
26
27
28
|
# File 'lib/radiustar/dictionary.rb', line 26
def find_attribute_by_name(name)
@attributes.find_by_name(name)
end
|
#name ⇒ Object
50
51
52
|
# File 'lib/radiustar/dictionary.rb', line 50
def name
"Dictionary"
end
|
#read_files(path) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/radiustar/dictionary.rb', line 16
def read_files(path)
dict_files = File.join(path, "*")
Dir.glob(dict_files) { |file|
read_attributes(file)
}
Dir.glob(dict_files) { |file|
read_values(file)
}
end
|
#vendors ⇒ Object
42
43
44
|
# File 'lib/radiustar/dictionary.rb', line 42
def vendors
@vendors
end
|