Class: Authorization::DevelopmentSupport::AnalyzerEngine::PrivilegesSet

Inherits:
Set
  • Object
show all
Defined in:
lib/declarative_authorization/development_support/development_support.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ PrivilegesSet

Returns a new instance of PrivilegesSet.



209
210
211
212
213
214
215
# File 'lib/declarative_authorization/development_support/development_support.rb', line 209

def initialize (*args)
  if args.length > 2
    @rule = args.shift
    @engine = args.shift
  end
  super(*args)
end

Instance Method Details

#delete(privilege) ⇒ Object



223
224
225
226
227
228
229
230
# File 'lib/declarative_authorization/development_support/development_support.rb', line 223

def delete (privilege)
  @rule.rule.privileges.delete(privilege.to_sym)
  if privilege.is_a?(Symbol)
    super(privilege_from_symbol(privilege))
  else
    super
  end
end

#include?(privilege) ⇒ Boolean

Returns:

  • (Boolean)


216
217
218
219
220
221
222
# File 'lib/declarative_authorization/development_support/development_support.rb', line 216

def include? (privilege)
  if privilege.is_a?(Symbol)
    super(privilege_from_symbol(privilege))
  else
    super
  end
end

#intersects?(privileges) ⇒ Boolean

Returns:

  • (Boolean)


232
233
234
# File 'lib/declarative_authorization/development_support/development_support.rb', line 232

def intersects? (privileges)
  intersection(privileges).length > 0
end