Class: Twiddler::TargetBuilder::RegexpBuilder

Inherits:
Builder
  • Object
show all
Defined in:
lib/twiddler/target_builder.rb

Direct Known Subclasses

Flow, Macros, ShortWords

Instance Method Summary collapse

Methods inherited from Builder

#initialize, #output_to, register, registered

Constructor Details

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

Instance Method Details

#goObject



47
48
49
50
51
52
53
# File 'lib/twiddler/target_builder.rb', line 47

def go
  output_to(filename) do |file|
    @dict.grep(regexp) do |word|
      file.puts(word)
    end
  end
end

#match_any_of(list) ⇒ Object



44
45
46
# File 'lib/twiddler/target_builder.rb', line 44

def match_any_of(list)
  return "(?:#{list.map{|it| Regexp::escape(it)}.join(")|(?:")})"
end