Module: Lexdrill::Toggle

Defined in:
lib/lexdrill/toggle.rb

Overview

Global pause/resume switch for the shell hook. Enabled by default; the marker file's presence means stopped.

Constant Summary collapse

PATH =
Lexdrill::Config.path("disabled")

Class Method Summary collapse

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/lexdrill/toggle.rb', line 10

def self.enabled?
  !File.exist?(PATH)
end

.startObject



14
15
16
# File 'lib/lexdrill/toggle.rb', line 14

def self.start
  FileUtils.rm_f(PATH)
end

.stopObject



18
19
20
# File 'lib/lexdrill/toggle.rb', line 18

def self.stop
  File.write(PATH, "")
end