Module: Speculate::Generator
Constant Summary collapse
- Error =
Class.new RuntimeError
Instance Method Summary collapse
Instance Method Details
#generate(pair) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/speculate/generator.rb', line 5 def generate pair unless pair.outdated? raise Error, "Must not call generate for #{pair.speculation.path} -> #{pair.spec.path}, because it is not outdated" end puts "Generating: #{pair.speculation.path} -> #{pair.spec.path}" text = Speculate::Parser.new(pair.speculation).parse File.open(pair.spec.path, "w"){ |f| f.puts _header(pair.speculation.path) f.puts text f.puts } end |