Class: Twiddler::TargetBuilder::Macros

Inherits:
RegexpBuilder show all
Defined in:
lib/twiddler/target_builder.rb

Instance Method Summary collapse

Methods inherited from RegexpBuilder

#go, #match_any_of

Methods inherited from Builder

#go, #initialize, #output_to, register, registered

Constructor Details

This class inherits a constructor from Twiddler::TargetBuilder::Builder

Instance Method Details

#filenameObject



71
72
73
# File 'lib/twiddler/target_builder.rb', line 71

def filename
  "Macros"
end

#regexpObject



75
76
77
78
79
80
81
82
# File 'lib/twiddler/target_builder.rb', line 75

def regexp
  macros = @config.keyboard.find_all do |chord|
    chord.keystrokes.length > 1 and chord.keystrokes.all? do |stroke|
      stroke[1].empty?
    end
  end
  return %r{^.{0,1}(?:#{match_any_of(macros.map{|chord| chord.render_action})}).{0,1}$}
end