Module: Speculations

Extended by:
Speculations
Included in:
Speculations
Defined in:
lib/speculations.rb,
lib/speculations/cli.rb,
lib/speculations/parser.rb,
lib/speculations/version.rb,
lib/speculations/parser/context.rb,
lib/speculations/parser/state/in.rb,
lib/speculations/parser/state/out.rb,
lib/speculations/parser/state/includes.rb,
lib/speculations/parser/state/candidate.rb,
lib/speculations/parser/state/context_maker.rb

Defined Under Namespace

Modules: CLI Classes: Parser

Constant Summary collapse

DISCLAIMER =
<<-EOD
# DO NOT EDIT!!!
# This file was generated from FILENAME with the speculate_about gem, if you modify this file
# one of two bad things will happen
# - your documentation specs are not correct
# - your modifications will be overwritten by the speculate command line
# YOU HAVE BEEN WARNED
EOD
VERSION =
"1.0.3"

Instance Method Summary collapse

Instance Method Details

#compile(infile, outfile = nil) ⇒ Object

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
21
22
23
# File 'lib/speculations.rb', line 14

def compile(infile, outfile=nil)
  raise ArgumentError, "#{infile} not found" unless File.readable? infile
  outfile ||= _speculation_path(infile)
  if _out_of_date?(outfile, infile)
    ast  = Speculations::Parser.new.parse_from_file(infile)
    code = _decorated_ast_code ast, infile
    File.write(outfile, code.join("\n"))
  end
  outfile
end