class Twiddler::Lint::MissingStrokes

Public Instance Methods

check() click to toggle source
# File lib/twiddler/lint.rb, line 36
def check()
  all_strokes = []
  @config.keytable.each do |key|
    all_strokes << [key.code, ""]
    all_strokes << [key.code, "shift"] if key.has_mod?("shift")
  end

  @config.keyboard.each do |chord|
    next unless chord.single?
    all_strokes.delete(@config.keytable.normalized(chord[0]))
  end

  if all_strokes.empty?
    return "Missing: all normal keystrokes accounted for"
  else
    return "Config lacks strokes: #{all_strokes.map{|str| @config.keytable[*str]}.inspect}"
  end
end