Class: Ddr::Auth::Roles::RoleSet
- Inherits:
-
Object
- Object
- Ddr::Auth::Roles::RoleSet
- Includes:
- ActiveModel::Serializers::JSON, Enumerable
- Defined in:
- lib/ddr/auth/roles/role_set.rb
Overview
Wraps a set of Roles
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_json(json) ⇒ Object
23 24 25 |
# File 'lib/ddr/auth/roles/role_set.rb', line 23 def self.from_json(json) new.from_json(json.present? ? json : "{}") end |
Instance Method Details
#==(other) ⇒ Object
27 28 29 |
# File 'lib/ddr/auth/roles/role_set.rb', line 27 def ==(other) instance_of?(other.class) && self.roles == other.roles end |
#agents ⇒ Object
40 41 42 |
# File 'lib/ddr/auth/roles/role_set.rb', line 40 def agents map(&:agent).uniq end |
#merge(other) ⇒ Object
31 32 33 34 |
# File 'lib/ddr/auth/roles/role_set.rb', line 31 def merge(other) self.roles += other.roles self end |
#permissions ⇒ Object
36 37 38 |
# File 'lib/ddr/auth/roles/role_set.rb', line 36 def map(&:permissions).flatten.uniq end |
#query ⇒ Object
44 45 46 |
# File 'lib/ddr/auth/roles/role_set.rb', line 44 def query RoleSetQuery.new(self) end |