Module: Lexdrill::Format
- Defined in:
- lib/lexdrill/format.rb
Overview
Global display mode for next's output: "simple" (the drill sign + word)
or "full" (position + loop info). Lives at ~/.drill.format; defaults to
"simple".
Constant Summary collapse
- PATH =
File.join(Dir.home, ".drill.format")
- SIMPLE =
"simple"- FULL =
"full"- VALID =
[SIMPLE, FULL].freeze
Class Method Summary collapse
Class Method Details
.current ⇒ Object
12 13 14 15 16 17 |
# File 'lib/lexdrill/format.rb', line 12 def self.current return SIMPLE unless File.exist?(PATH) value = File.read(PATH).strip VALID.include?(value) ? value : SIMPLE end |
.set(mode) ⇒ Object
19 20 21 |
# File 'lib/lexdrill/format.rb', line 19 def self.set(mode) File.write(PATH, mode) end |
.simple? ⇒ Boolean
23 24 25 |
# File 'lib/lexdrill/format.rb', line 23 def self.simple? current == SIMPLE end |