Class: MutatorRails::Guide

Inherits:
Object
  • Object
show all
Defined in:
lib/mutator_rails/guide.rb

Constant Summary collapse

SEP =
' | '.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGuide

Returns a new instance of Guide.



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

def initialize(*)
  preset_file
end

Instance Attribute Details

#guidesObject (readonly)

Returns the value of attribute guides.



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

def guides
  @guides
end

Instance Method Details

#current?(log, code_md5, spec_md5) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
# File 'lib/mutator_rails/guide.rb', line 14

def current?(log, code_md5, spec_md5)
  # p guides[log]
  File.exist?(log) &&
    File.size(log).positive? &&
    log_exists?(log) &&
    guides[log].eql?([code_md5, spec_md5, MUTANT_VERSION])
end

#log_exists?(log) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/mutator_rails/guide.rb', line 27

def log_exists?(log)
  guides[log].present?
end

#remove(log) ⇒ Object



31
32
33
34
# File 'lib/mutator_rails/guide.rb', line 31

def remove(log)
  guides.delete(log)
  recreate
end

#update(log, code_md5, spec_md5) ⇒ Object



22
23
24
25
# File 'lib/mutator_rails/guide.rb', line 22

def update(log, code_md5, spec_md5)
  guides[log] = [code_md5, spec_md5, MUTANT_VERSION]
  recreate
end