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

HELPER_FILE =
'speculations_helper'
HELPER_PATH =
"spec/#{HELPER_FILE}.rb"
DISCLAIMER =
"# DO NOT EDIT!!!\n# This file was generated from FILENAME with the speculate_about gem, if you modify this file\n# one of two bad things will happen\n# - your documentation specs are not correct\n# - your modifications will be overwritten by the speculate command line\n# YOU HAVE BEEN WARNED\n"
VERSION =
"1.1.3"

Instance Method Summary collapse

Instance Method Details

#compile(infile, outfile = nil, debug: false, force: false) ⇒ Object

Raises:

  • (ArgumentError)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/speculations.rb', line 18

def compile(infile, outfile=nil, debug: false, force: false)
  raise ArgumentError, "#{infile} not found" unless File.readable? infile
  outfile ||= _speculation_path(infile)
  if _out_of_date?(outfile, infile)
    debug__(msg: "recompiling #{infile} -> #{outfile}", debug:)
    _compile(infile:, outfile:, debug:)
  elsif force
    debug__(msg: "*** forced recompilation #{infile} -> #{outfile}", debug:)
    _compile(infile:, outfile:, debug:)
  else
    debug__(msg: "#{infile} ignored as it is upto date", debug:)
  end
  outfile
end