Class: Authorization::Engine::AttributeValidator

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(engine, user, object = nil, privilege = nil, context = nil) ⇒ AttributeValidator

Returns a new instance of AttributeValidator.


305
306
307
308
309
310
311
# File 'lib/declarative_authorization/authorization.rb', line 305

def initialize (engine, user, object = nil, privilege = nil, context = nil)
  @engine = engine
  @user = user
  @object = object
  @privilege = privilege
  @context = context
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context


304
305
306
# File 'lib/declarative_authorization/authorization.rb', line 304

def context
  @context
end

#engineObject (readonly)

Returns the value of attribute engine


304
305
306
# File 'lib/declarative_authorization/authorization.rb', line 304

def engine
  @engine
end

#objectObject (readonly)

Returns the value of attribute object


304
305
306
# File 'lib/declarative_authorization/authorization.rb', line 304

def object
  @object
end

#privilegeObject (readonly)

Returns the value of attribute privilege


304
305
306
# File 'lib/declarative_authorization/authorization.rb', line 304

def privilege
  @privilege
end

#userObject (readonly)

Returns the value of attribute user


304
305
306
# File 'lib/declarative_authorization/authorization.rb', line 304

def user
  @user
end

Instance Method Details

#evaluate(value_block) ⇒ Object


313
314
315
316
# File 'lib/declarative_authorization/authorization.rb', line 313

def evaluate (value_block)
  # TODO cache?
  instance_eval(&value_block)
end