Class: CanTango::Configuration::Engines::Engine

Inherits:
Object
  • Object
show all
Includes:
Modes, Singleton
Defined in:
lib/cantango/configuration/engines/engine.rb

Direct Known Subclasses

Permission, Permit, UserAc

Instance Method Summary collapse

Methods included from Modes

#mode=, #modes

Instance Method Details

#off?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/cantango/configuration/engines/engine.rb', line 23

def off?
  !on?
end

#on?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/cantango/configuration/engines/engine.rb', line 19

def on?
  @state == :on
end

#reset!Object



15
16
17
# File 'lib/cantango/configuration/engines/engine.rb', line 15

def reset!
  @state = nil
end

#set(state = :on) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
# File 'lib/cantango/configuration/engines/engine.rb', line 10

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