Module: Bali::Objector

Defined in:
lib/bali/objector.rb

Overview

module that will be included in each instantiated target classes as defined in map_rules

Defined Under Namespace

Modules: Statics

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/bali/objector.rb', line 4

def self.included(base)
  base.extend Bali::Objector::Statics
end

Instance Method Details

#can!(subtargets, operation) ⇒ Object

check whether user can/cant perform an operation, raise an error when access is denied



16
17
18
# File 'lib/bali/objector.rb', line 16

def can!(subtargets, operation)
  self.class.can!(subtargets, operation, self)
end

#can?(subtargets, operation) ⇒ Boolean

check whether user can/cant perform an operation, return true when positive or false otherwise

Returns:

  • (Boolean)


10
11
12
# File 'lib/bali/objector.rb', line 10

def can?(subtargets, operation)
  self.class.can?(subtargets, operation, self)
end

#cannot!(subtargets, operation) ⇒ Object

check whether user can/cant perform an operation, raise an error when access is given



28
29
30
# File 'lib/bali/objector.rb', line 28

def cannot!(subtargets, operation)
  self.class.cannot!(subtargets, operation, self)
end

#cannot?(subtargets, operation) ⇒ Boolean

check whether user can/cant perform an operation, return true when negative or false otherwise

Returns:

  • (Boolean)


22
23
24
# File 'lib/bali/objector.rb', line 22

def cannot?(subtargets, operation)
  self.class.cannot?(subtargets, operation, self)
end

#cant!(subtargets, operation) ⇒ Object



37
38
39
40
# File 'lib/bali/objector.rb', line 37

def cant!(subtargets, operation)
  puts "Deprecation Warning: please use cannot! instead, cant! will be deprecated on major release 3.0"
  cannot!(subtargets, operation)
end

#cant?(subtargets, operation) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
# File 'lib/bali/objector.rb', line 32

def cant?(subtargets, operation)
  puts "Deprecation Warning: please use cannot? instead, cant? will be deprecated on major release 3.0"
  cannot?(subtargets, operation)
end