Class: Ddr::Auth::Roles::Query

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/ddr/auth/roles/query.rb

Instance Method Summary collapse

Constructor Details

#initialize(role_set) ⇒ Query

Returns a new instance of Query.



8
9
10
# File 'lib/ddr/auth/roles/query.rb', line 8

def initialize(role_set)
  super(role_set.to_a)
end

Instance Method Details

#where(criteria) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/ddr/auth/roles/query.rb', line 12

def where(criteria)
  matching = select do |role|
    criteria.all? do |key, value|
      send("any_#{key}?", value, role)
    end
  end
  __setobj__(matching)
  self
end