Class: LcpRuby::Groups::HostLoader
- Inherits:
-
Object
- Object
- LcpRuby::Groups::HostLoader
- Includes:
- Contract
- Defined in:
- lib/lcp_ruby/groups/host_loader.rb
Instance Method Summary collapse
-
#all_group_names ⇒ Array<String>
Delegates to the host adapter.
-
#groups_for_user(user) ⇒ Array<String>
Delegates to the host adapter.
-
#initialize(adapter) ⇒ HostLoader
constructor
A new instance of HostLoader.
-
#roles_for_group(group_name) ⇒ Array<String>
Delegates to the host adapter.
-
#roles_for_user(user) ⇒ Array<String>
Delegates to the host adapter when it provides an optimized implementation.
-
#user_ids_for_group(group_name) ⇒ Array<Integer>
Delegates to the host adapter when it provides the method.
Constructor Details
#initialize(adapter) ⇒ HostLoader
Returns a new instance of HostLoader.
6 7 8 |
# File 'lib/lcp_ruby/groups/host_loader.rb', line 6 def initialize(adapter) @adapter = adapter end |
Instance Method Details
#all_group_names ⇒ Array<String>
Delegates to the host adapter.
12 13 14 |
# File 'lib/lcp_ruby/groups/host_loader.rb', line 12 def all_group_names @adapter.all_group_names end |
#groups_for_user(user) ⇒ Array<String>
Delegates to the host adapter.
19 20 21 |
# File 'lib/lcp_ruby/groups/host_loader.rb', line 19 def groups_for_user(user) @adapter.groups_for_user(user) end |
#roles_for_group(group_name) ⇒ Array<String>
Delegates to the host adapter.
26 27 28 |
# File 'lib/lcp_ruby/groups/host_loader.rb', line 26 def roles_for_group(group_name) @adapter.roles_for_group(group_name) end |
#roles_for_user(user) ⇒ Array<String>
Delegates to the host adapter when it provides an optimized implementation. Otherwise falls back to the default composition.
45 46 47 48 49 50 51 |
# File 'lib/lcp_ruby/groups/host_loader.rb', line 45 def roles_for_user(user) if @adapter.respond_to?(:roles_for_user) @adapter.roles_for_user(user) else super end end |
#user_ids_for_group(group_name) ⇒ Array<Integer>
Delegates to the host adapter when it provides the method.
33 34 35 36 37 38 39 |
# File 'lib/lcp_ruby/groups/host_loader.rb', line 33 def user_ids_for_group(group_name) if @adapter.respond_to?(:user_ids_for_group) @adapter.user_ids_for_group(group_name) else [] end end |