7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/ez/settings/accessors.rb', line 7
def [](interface_name, group_name, key_name)
interface = Ez::Registry.data(:settings_interfaces).find do |interface|
interface.name == interface_name.to_sym
end
unless interface
raise NotRegistredInterfaceError, "Interface #{interface_name} is not registred!"
end
group = interface.groups.find { |g| g.name == group_name.to_sym }
unless group
raise NotRegistredGroupError, "Group #{group_name} is not registred for #{interface_name} interface"
end
store = Ez::Settings::Store.new(group, interface.config.backend)
begin
store.send(key_name.to_sym)
rescue NoMethodError
raise NotRegistredKeyError, "Key #{key_name} is not registred for #{interface_name} interface, #{group_name} group"
end
end
|