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

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

Direct Known Subclasses

Permission, Permit

Instance Method Summary collapse

Instance Method Details

#off?Boolean

Returns:

  • (Boolean)


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

def off?
  !on?
end

#on?Boolean

Returns:

  • (Boolean)


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

def on?
  @state == :on
end

#reset!Object



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

def reset!
  @state = nil
end

#set(state = :on) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
# File 'lib/cantango/configuration/engines/engine.rb', line 5

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