Module: Speculate

Extended by:
Speculate
Included in:
Speculate
Defined in:
lib/speculate.rb

Defined Under Namespace

Modules: Dirs, Generator Classes: Args, Parser, SpecPair

Constant Summary collapse

BASE_DIR =
'spec/speculations'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



8
9
10
# File 'lib/speculate.rb', line 8

def args
  @args
end

Instance Method Details

#base_dirObject



10
11
12
# File 'lib/speculate.rb', line 10

def base_dir
  @__base_dir__ ||= args.fetch!(:dest, BASE_DIR) 
end

#run(args) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/speculate.rb', line 26

def run args
  @args = Args.new args
  if @args.flag!(:force)
    _force speculations
  end
  speculations
    .filter(&:outdated?)
    .each(&Generator.method(:generate))
end

#speculationsObject



14
15
16
# File 'lib/speculate.rb', line 14

def speculations
  @__speculations__ ||= _speculations
end

#speculations_dirObject



18
19
20
# File 'lib/speculate.rb', line 18

def speculations_dir
  @__speculations_dir__ ||= args.fetch!(:dir, 'spec/speculations')
end

#speculations_globObject



22
23
24
# File 'lib/speculate.rb', line 22

def speculations_glob
  @__speculations_glob__ ||= args.fetch!(:glob, '**/*.md')
end