Class: CanTango::Config::Ability::Engine

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/cantango/config/ability/engine.rb

Instance Method Summary collapse

Instance Method Details

#off?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/cantango/config/ability/engine.rb', line 39

def off?
  !on?
end

#on?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/cantango/config/ability/engine.rb', line 35

def on?
  @state == :on
end

#reset!Object



31
32
33
# File 'lib/cantango/config/ability/engine.rb', line 31

def reset!
  @state = nil
end

#set(state = :on) ⇒ Object

Raises:

  • (ArgumentError)


26
27
28
29
# File 'lib/cantango/config/ability/engine.rb', line 26

def set state = :on
  raise ArgumentError, "Must be :on or :off" unless !state || [:on, :off].include?(state)
  @state = state || :on
end