Module: Lexdrill::Toggle

Defined in:
lib/lexdrill/toggle.rb

Overview

Global pause/resume switch for the shell hook, independent of which project's .drill.txt is active. Enabled by default; the marker file's presence means stopped.

Constant Summary collapse

PATH =
File.join(Dir.home, ".drill.disabled")

Class Method Summary collapse

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


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

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

.startObject



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

def self.start
  FileUtils.rm_f(PATH)
end

.stopObject



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

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