Module: Speculations

Extended by:
Speculations
Includes:
Debugging
Included in:
Speculations
Defined in:
lib/speculations.rb,
lib/speculations/cli.rb,
lib/speculations/data.rb,
lib/speculations/parser.rb,
lib/speculations/version.rb,
lib/speculations/debugging.rb,
lib/speculations/parser/context.rb,
lib/speculations/parser/state/in.rb,
lib/speculations/parser/state/out.rb,
lib/speculations/parser/state/examples.rb,
lib/speculations/parser/state/includes.rb,
lib/speculations/parser/state/candidate.rb,
lib/speculations/parser/state/context_maker.rb,
lib/speculations/parser/state/specify_block.rb

Defined Under Namespace

Modules: CLI, Debugging Classes: Data, Parser

Constant Summary collapse

HELPER_FILE =
'speculations_helper'
HELPER_PATH =
"spec/#{HELPER_FILE}.rb"
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.3.2"

Constants included from Debugging

Debugging::S

Instance Method Summary collapse

Methods included from Debugging

#dbg_match, #debug__

Instance Method Details

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

Raises:

  • (ArgumentError)


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

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 ", :b_blue, infile, :reset, " -> ", :b_blue, outfile], debug:)
    _compile(infile:, outfile:, debug:)
  elsif force
    debug__(msg: [:b_yellow, "*** forced recompilation ", :b_blue, infile, :reset, " -> ", :b_blue, outfile], debug:)
    _compile(infile:, outfile:, debug:)
  else
    debug__(msg: [:green, infile, :reset, " ignored as it is upto date"], debug:)
  end
  outfile
end