class Twiddler::TargetBuilder::Flow
Public Instance Methods
filename()
click to toggle source
# File lib/twiddler/target_builder.rb, line 88 def filename "Flow" end
regexp()
click to toggle source
# File lib/twiddler/target_builder.rb, line 92 def regexp flow = [] chords = @config.keyboard.find_all do |chord| chord.single? and chord.keystrokes[0][1].empty? and Config.keytable.is_tagged?(chord.keystrokes[0][0], :letters) end chords.each do |first| chords.each do |second| next if first == second pairs = first.rows.zip(second.rows).find_all{|one,two| one != two} case pairs.length when 1 flow << first.render_action + second.render_action next when 2 next if pairs.find{|pair| !pair.include?(:open)} if pairs[0][0] == pairs[1][1] and pairs[0][1] == pairs[1][0] flow << first.render_action + second.render_action next end end end end return %r{^.{0,1}(?:#{match_any_of(flow)}).{0,1}$} end