Module: CanDo

Defined in:
lib/can_do.rb,
lib/can_do/dsl.rb,
lib/can_do/permission_error.rb

Defined Under Namespace

Classes: Dsl, PermissionError

Class Method Summary collapse

Class Method Details

.can?(verb, noun, &block) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/can_do.rb', line 9

def self.can?(verb, noun, &block)
  raise "you must first call setup" unless @active_dsl
  @active_dsl.can?(verb, noun, &block)
end

.reason(verb, noun) ⇒ Object



14
15
16
17
# File 'lib/can_do.rb', line 14

def self.reason(verb, noun)
  raise "you must first call setup" unless @active_dsl
  @active_dsl.reason(verb, noun)
end

.setup(&block) ⇒ Object



5
6
7
# File 'lib/can_do.rb', line 5

def self.setup &block
  @active_dsl = CanDo::Dsl.new &block
end