mutant 0.8.8 → 0.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +9 -0
  3. data/README.md +1 -1
  4. data/Rakefile +12 -8
  5. data/bin/mutant +5 -1
  6. data/config/flay.yml +1 -1
  7. data/lib/mutant.rb +18 -17
  8. data/lib/mutant/actor.rb +1 -7
  9. data/lib/mutant/actor/env.rb +0 -4
  10. data/lib/mutant/actor/mailbox.rb +0 -4
  11. data/lib/mutant/actor/receiver.rb +0 -4
  12. data/lib/mutant/actor/sender.rb +0 -2
  13. data/lib/mutant/ast.rb +1 -5
  14. data/lib/mutant/ast/meta/const.rb +0 -2
  15. data/lib/mutant/ast/meta/optarg.rb +0 -2
  16. data/lib/mutant/ast/meta/send.rb +0 -12
  17. data/lib/mutant/ast/named_children.rb +0 -10
  18. data/lib/mutant/ast/sexp.rb +1 -5
  19. data/lib/mutant/cli.rb +19 -38
  20. data/lib/mutant/color.rb +1 -7
  21. data/lib/mutant/config.rb +11 -7
  22. data/lib/mutant/context.rb +0 -4
  23. data/lib/mutant/context/scope.rb +0 -18
  24. data/lib/mutant/delegator.rb +0 -6
  25. data/lib/mutant/diff.rb +0 -18
  26. data/lib/mutant/env.rb +8 -24
  27. data/lib/mutant/env/bootstrap.rb +18 -41
  28. data/lib/mutant/expression.rb +0 -8
  29. data/lib/mutant/expression/method.rb +6 -7
  30. data/lib/mutant/expression/methods.rb +5 -9
  31. data/lib/mutant/expression/namespace.rb +0 -13
  32. data/lib/mutant/expression/parser.rb +0 -6
  33. data/lib/mutant/integration.rb +2 -20
  34. data/lib/mutant/isolation.rb +0 -4
  35. data/lib/mutant/loader.rb +20 -35
  36. data/lib/mutant/matcher.rb +1 -1
  37. data/lib/mutant/matcher/chain.rb +1 -3
  38. data/lib/mutant/matcher/compiler.rb +0 -8
  39. data/lib/mutant/matcher/config.rb +2 -10
  40. data/lib/mutant/matcher/filter.rb +1 -3
  41. data/lib/mutant/matcher/method.rb +4 -26
  42. data/lib/mutant/matcher/method/instance.rb +1 -7
  43. data/lib/mutant/matcher/method/singleton.rb +0 -12
  44. data/lib/mutant/matcher/methods.rb +1 -19
  45. data/lib/mutant/matcher/namespace.rb +1 -7
  46. data/lib/mutant/matcher/null.rb +1 -3
  47. data/lib/mutant/matcher/scope.rb +1 -5
  48. data/lib/mutant/matcher/static.rb +0 -2
  49. data/lib/mutant/meta.rb +0 -2
  50. data/lib/mutant/meta/example.rb +0 -28
  51. data/lib/mutant/meta/example/dsl.rb +2 -16
  52. data/lib/mutant/mutation.rb +9 -18
  53. data/lib/mutant/mutator.rb +0 -24
  54. data/lib/mutant/mutator/node.rb +1 -33
  55. data/lib/mutant/mutator/node/and_asgn.rb +0 -2
  56. data/lib/mutant/mutator/node/argument.rb +0 -10
  57. data/lib/mutant/mutator/node/arguments.rb +0 -12
  58. data/lib/mutant/mutator/node/begin.rb +0 -4
  59. data/lib/mutant/mutator/node/binary.rb +2 -11
  60. data/lib/mutant/mutator/node/block.rb +0 -6
  61. data/lib/mutant/mutator/node/break.rb +0 -2
  62. data/lib/mutant/mutator/node/case.rb +0 -6
  63. data/lib/mutant/mutator/node/conditional_loop.rb +0 -2
  64. data/lib/mutant/mutator/node/const.rb +1 -3
  65. data/lib/mutant/mutator/node/define.rb +4 -11
  66. data/lib/mutant/mutator/node/defined.rb +0 -2
  67. data/lib/mutant/mutator/node/dstr.rb +0 -2
  68. data/lib/mutant/mutator/node/dsym.rb +0 -2
  69. data/lib/mutant/mutator/node/generic.rb +1 -3
  70. data/lib/mutant/mutator/node/if.rb +0 -8
  71. data/lib/mutant/mutator/node/kwbegin.rb +0 -2
  72. data/lib/mutant/mutator/node/literal/array.rb +0 -4
  73. data/lib/mutant/mutator/node/literal/boolean.rb +0 -2
  74. data/lib/mutant/mutator/node/literal/fixnum.rb +0 -6
  75. data/lib/mutant/mutator/node/literal/float.rb +0 -6
  76. data/lib/mutant/mutator/node/literal/hash.rb +0 -6
  77. data/lib/mutant/mutator/node/literal/nil.rb +0 -2
  78. data/lib/mutant/mutator/node/literal/range.rb +0 -8
  79. data/lib/mutant/mutator/node/literal/regex.rb +0 -4
  80. data/lib/mutant/mutator/node/literal/string.rb +0 -2
  81. data/lib/mutant/mutator/node/literal/symbol.rb +0 -2
  82. data/lib/mutant/mutator/node/masgn.rb +0 -2
  83. data/lib/mutant/mutator/node/match_current_line.rb +0 -2
  84. data/lib/mutant/mutator/node/mlhs.rb +0 -2
  85. data/lib/mutant/mutator/node/named_value/access.rb +0 -8
  86. data/lib/mutant/mutator/node/named_value/constant_assignment.rb +1 -7
  87. data/lib/mutant/mutator/node/named_value/variable_assignment.rb +0 -4
  88. data/lib/mutant/mutator/node/next.rb +0 -2
  89. data/lib/mutant/mutator/node/noop.rb +0 -2
  90. data/lib/mutant/mutator/node/nthref.rb +0 -2
  91. data/lib/mutant/mutator/node/op_asgn.rb +0 -2
  92. data/lib/mutant/mutator/node/or_asgn.rb +0 -2
  93. data/lib/mutant/mutator/node/resbody.rb +0 -4
  94. data/lib/mutant/mutator/node/rescue.rb +0 -10
  95. data/lib/mutant/mutator/node/return.rb +0 -2
  96. data/lib/mutant/mutator/node/send.rb +4 -32
  97. data/lib/mutant/mutator/node/send/attribute_assignment.rb +0 -6
  98. data/lib/mutant/mutator/node/send/binary.rb +0 -6
  99. data/lib/mutant/mutator/node/send/index.rb +0 -6
  100. data/lib/mutant/mutator/node/splat.rb +0 -2
  101. data/lib/mutant/mutator/node/super.rb +0 -2
  102. data/lib/mutant/mutator/node/when.rb +0 -10
  103. data/lib/mutant/mutator/node/yield.rb +0 -2
  104. data/lib/mutant/mutator/node/zsuper.rb +0 -2
  105. data/lib/mutant/mutator/registry.rb +0 -6
  106. data/lib/mutant/mutator/util.rb +0 -4
  107. data/lib/mutant/mutator/util/array.rb +0 -6
  108. data/lib/mutant/mutator/util/symbol.rb +0 -2
  109. data/lib/mutant/parallel.rb +21 -17
  110. data/lib/mutant/parallel/master.rb +0 -28
  111. data/lib/mutant/parallel/source.rb +0 -10
  112. data/lib/mutant/parallel/worker.rb +15 -10
  113. data/lib/mutant/parser.rb +23 -0
  114. data/lib/mutant/reporter.rb +5 -8
  115. data/lib/mutant/reporter/cli.rb +1 -15
  116. data/lib/mutant/reporter/cli/format.rb +3 -25
  117. data/lib/mutant/reporter/cli/printer.rb +0 -18
  118. data/lib/mutant/reporter/cli/printer/config.rb +0 -2
  119. data/lib/mutant/reporter/cli/printer/env_progress.rb +0 -2
  120. data/lib/mutant/reporter/cli/printer/env_result.rb +0 -2
  121. data/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +0 -4
  122. data/lib/mutant/reporter/cli/printer/mutation_result.rb +0 -16
  123. data/lib/mutant/reporter/cli/printer/status.rb +0 -6
  124. data/lib/mutant/reporter/cli/printer/status_progressive.rb +0 -4
  125. data/lib/mutant/reporter/cli/printer/subject_progress.rb +0 -8
  126. data/lib/mutant/reporter/cli/printer/subject_result.rb +0 -2
  127. data/lib/mutant/reporter/cli/printer/test_result.rb +0 -2
  128. data/lib/mutant/reporter/cli/tput.rb +0 -4
  129. data/lib/mutant/repository.rb +4 -22
  130. data/lib/mutant/require_highjack.rb +0 -2
  131. data/lib/mutant/result.rb +23 -43
  132. data/lib/mutant/runner.rb +7 -20
  133. data/lib/mutant/runner/sink.rb +43 -86
  134. data/lib/mutant/selector.rb +0 -2
  135. data/lib/mutant/selector/expression.rb +0 -2
  136. data/lib/mutant/subject.rb +0 -22
  137. data/lib/mutant/subject/method.rb +2 -10
  138. data/lib/mutant/subject/method/instance.rb +0 -6
  139. data/lib/mutant/subject/method/singleton.rb +0 -2
  140. data/lib/mutant/test.rb +4 -3
  141. data/lib/mutant/version.rb +1 -1
  142. data/lib/mutant/warning_filter.rb +0 -10
  143. data/lib/mutant/zombifier.rb +5 -20
  144. data/meta/or_asgn.rb +6 -0
  145. data/meta/send.rb +29 -0
  146. data/mutant-rspec.gemspec +1 -1
  147. data/spec/integration/mutant/rspec_spec.rb +1 -1
  148. data/spec/integrations.yml +2 -3
  149. data/spec/shared/method_matcher_behavior.rb +7 -7
  150. data/spec/spec_helper.rb +2 -9
  151. data/spec/support/corpus.rb +37 -30
  152. data/spec/support/rb_bug.rb +1 -2
  153. data/spec/support/ruby_vm.rb +6 -3
  154. data/spec/support/shared_context.rb +19 -20
  155. data/spec/unit/mutant/actor/binding_spec.rb +6 -6
  156. data/spec/unit/mutant/actor/env_spec.rb +2 -2
  157. data/spec/unit/mutant/actor/mailbox_spec.rb +6 -6
  158. data/spec/unit/mutant/actor/message_spec.rb +2 -2
  159. data/spec/unit/mutant/actor/receiver_spec.rb +4 -4
  160. data/spec/unit/mutant/actor/sender_spec.rb +6 -6
  161. data/spec/unit/mutant/ast_spec.rb +9 -0
  162. data/spec/unit/mutant/cli_spec.rb +16 -10
  163. data/spec/unit/mutant/context/scope/root_spec.rb +1 -1
  164. data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +1 -1
  165. data/spec/unit/mutant/context/scope_spec.rb +3 -3
  166. data/spec/unit/mutant/context_spec.rb +0 -22
  167. data/spec/unit/mutant/env/boostrap_spec.rb +34 -41
  168. data/spec/unit/mutant/env_spec.rb +74 -32
  169. data/spec/unit/mutant/integration/rspec_spec.rb +23 -17
  170. data/spec/unit/mutant/integration_spec.rb +4 -4
  171. data/spec/unit/mutant/isolation_spec.rb +4 -4
  172. data/spec/unit/mutant/loader_spec.rb +42 -0
  173. data/spec/unit/mutant/matcher/compiler_spec.rb +3 -3
  174. data/spec/unit/mutant/matcher/config_spec.rb +1 -1
  175. data/spec/unit/mutant/matcher/method/instance_spec.rb +8 -1
  176. data/spec/unit/mutant/matcher/method/singleton_spec.rb +8 -1
  177. data/spec/unit/mutant/matcher/namespace_spec.rb +7 -8
  178. data/spec/unit/mutant/matcher/null_spec.rb +3 -2
  179. data/spec/unit/mutant/mutation_spec.rb +11 -5
  180. data/spec/unit/mutant/mutator/registry_spec.rb +1 -1
  181. data/spec/unit/mutant/parallel/master_spec.rb +9 -9
  182. data/spec/unit/mutant/parallel/source/array_spec.rb +3 -3
  183. data/spec/unit/mutant/parallel/worker_spec.rb +5 -5
  184. data/spec/unit/mutant/parallel_spec.rb +4 -4
  185. data/spec/unit/mutant/parser_spec.rb +24 -0
  186. data/spec/unit/mutant/reporter/cli/printer_spec.rb +3 -3
  187. data/spec/unit/mutant/reporter/cli/tput_spec.rb +2 -2
  188. data/spec/unit/mutant/reporter/cli_spec.rb +7 -7
  189. data/spec/unit/mutant/reporter/null_spec.rb +5 -4
  190. data/spec/unit/mutant/repository/diff_spec.rb +30 -18
  191. data/spec/unit/mutant/repository/subject_filter_spec.rb +5 -5
  192. data/spec/unit/mutant/require_highjack_spec.rb +1 -1
  193. data/spec/unit/mutant/result/env_spec.rb +9 -9
  194. data/spec/unit/mutant/result/subject_spec.rb +5 -5
  195. data/spec/unit/mutant/runner/driver_spec.rb +4 -4
  196. data/spec/unit/mutant/runner/{sink/mutation_spec.rb → sink_spec.rb} +16 -4
  197. data/spec/unit/mutant/runner_spec.rb +31 -31
  198. data/spec/unit/mutant/selector/expression_spec.rb +8 -8
  199. data/spec/unit/mutant/subject/method/instance_spec.rb +9 -3
  200. data/spec/unit/mutant/subject/method/singleton_spec.rb +1 -1
  201. data/spec/unit/mutant/subject_spec.rb +1 -5
  202. data/spec/unit/mutant_spec.rb +3 -3
  203. metadata +9 -15
  204. data/config/mutant.yml +0 -14
  205. data/lib/mutant/cache.rb +0 -29
  206. data/lib/mutant/reporter/trace.rb +0 -36
  207. data/spec/support/rspec.rb +0 -21
  208. data/spec/unit/mutant/cache_spec.rb +0 -22
  209. data/spec/unit/mutant/loader/eval_spec.rb +0 -44
  210. data/spec/unit/mutant/reporter/trace_spec.rb +0 -21
  211. data/test_app/Gemfile.rspec3.2 +0 -7
@@ -17,8 +17,6 @@ module Mutant
17
17
  # Perform dispatch
18
18
  #
19
19
  # @return [undefined]
20
- #
21
- # @api private
22
20
  def dispatch
23
21
  emit_naked_receiver
24
22
  emit_value_mutations
@@ -30,8 +28,6 @@ module Mutant
30
28
  # Mutate indices
31
29
  #
32
30
  # @return [undefined]
33
- #
34
- # @api private
35
31
  def mutate_indices
36
32
  children_indices(INDEX_RANGE).each do |index|
37
33
  delete_child(index)
@@ -42,8 +38,6 @@ module Mutant
42
38
  # Emit index read
43
39
  #
44
40
  # @return [undefined]
45
- #
46
- # @api private
47
41
  def emit_index_read
48
42
  emit_type(receiver, :[], *children[INDEX_RANGE])
49
43
  end
@@ -13,8 +13,6 @@ module Mutant
13
13
  # Perform dispatch
14
14
  #
15
15
  # @return [undefined]
16
- #
17
- # @api private
18
16
  def dispatch
19
17
  emit_singletons
20
18
  emit_expression_mutations
@@ -12,8 +12,6 @@ module Mutant
12
12
  # Emit mutations
13
13
  #
14
14
  # @return [undefined]
15
- #
16
- # @api private
17
15
  def dispatch
18
16
  emit_singletons
19
17
  emit(N_EMPTY_SUPER)
@@ -12,8 +12,6 @@ module Mutant
12
12
  # Emit mutations
13
13
  #
14
14
  # @return [undefined]
15
- #
16
- # @api private
17
15
  def dispatch
18
16
  if body
19
17
  mutate_body
@@ -26,8 +24,6 @@ module Mutant
26
24
  # Emit condition mutations
27
25
  #
28
26
  # @return [undefined]
29
- #
30
- # @api private
31
27
  def mutate_conditions
32
28
  conditions = children.length - 1
33
29
  children[0..-2].each_index do |index|
@@ -39,8 +35,6 @@ module Mutant
39
35
  # Emit body mutations
40
36
  #
41
37
  # @return [undefined]
42
- #
43
- # @api private
44
38
  def mutate_body
45
39
  mutate_child(body_index)
46
40
  end
@@ -52,8 +46,6 @@ module Mutant
52
46
  #
53
47
  # @return [nil]
54
48
  # otherwise
55
- #
56
- # @api private
57
49
  def body
58
50
  children[body_index]
59
51
  end
@@ -61,8 +53,6 @@ module Mutant
61
53
  # Index of body node
62
54
  #
63
55
  # @return [Fixnum]
64
- #
65
- # @api private
66
56
  def body_index
67
57
  children.length - 1
68
58
  end
@@ -12,8 +12,6 @@ module Mutant
12
12
  # Emit mutations
13
13
  #
14
14
  # @return [undefined]
15
- #
16
- # @api private
17
15
  def dispatch
18
16
  super
19
17
  emit_singletons
@@ -12,8 +12,6 @@ module Mutant
12
12
  # Emit mutations
13
13
  #
14
14
  # @return [undefined]
15
- #
16
- # @api private
17
15
  def dispatch
18
16
  emit_singletons
19
17
  emit(N_EMPTY_SUPER)
@@ -6,8 +6,6 @@ module Mutant
6
6
  # Initialize object
7
7
  #
8
8
  # @return [undefined]
9
- #
10
- # @api private
11
9
  def initialize
12
10
  @registry = {}
13
11
  end
@@ -21,8 +19,6 @@ module Mutant
21
19
  # @param [Class:Mutator] mutator
22
20
  #
23
21
  # @return [self]
24
- #
25
- # @api private
26
22
  def register(type, mutator)
27
23
  fail RegistryError, "Invalid type registration: #{type}" unless AST::Types::ALL.include?(type)
28
24
  fail RegistryError, "Duplicate type registration: #{type}" if @registry.key?(type)
@@ -38,8 +34,6 @@ module Mutant
38
34
  #
39
35
  # @raise [ArgumentError]
40
36
  # raises argument error when mutator class cannot be found
41
- #
42
- # @api private
43
37
  def lookup(node)
44
38
  type = node.type
45
39
  @registry.fetch(type) do
@@ -13,8 +13,6 @@ module Mutant
13
13
  #
14
14
  # @return [self]
15
15
  # otherwise
16
- #
17
- # @api private
18
16
  def self.each(object, parent, &block)
19
17
  return to_enum(__method__, object, parent) unless block_given?
20
18
 
@@ -30,8 +28,6 @@ module Mutant
30
28
  # @param [Object] generated
31
29
  #
32
30
  # @return [Boolean]
33
- #
34
- # @api private
35
31
  def new?(generated)
36
32
  !input.eql?(generated)
37
33
  end
@@ -13,8 +13,6 @@ module Mutant
13
13
  # Emit element presence mutations
14
14
  #
15
15
  # @return [undefined]
16
- #
17
- # @api private
18
16
  def dispatch
19
17
  input.each_index do |index|
20
18
  dup = dup_input
@@ -33,8 +31,6 @@ module Mutant
33
31
  # Emit mutations
34
32
  #
35
33
  # @return [undefined]
36
- #
37
- # @api private
38
34
  def dispatch
39
35
  input.each_with_index do |element, index|
40
36
  Mutator.each(element).each do |mutation|
@@ -52,8 +48,6 @@ module Mutant
52
48
  # Emit mutations
53
49
  #
54
50
  # @return [undefined]
55
- #
56
- # @api private
57
51
  def dispatch
58
52
  run(Element)
59
53
  run(Presence)
@@ -12,8 +12,6 @@ module Mutant
12
12
  # Emit mutations
13
13
  #
14
14
  # @return [undefined]
15
- #
16
- # @api private
17
15
  def dispatch
18
16
  emit((input.to_s + POSTFIX).to_sym)
19
17
  end
@@ -9,8 +9,6 @@ module Mutant
9
9
  # Scheduler status
10
10
  #
11
11
  # @return [Object]
12
- #
13
- # @api private
14
12
  def status
15
13
  binding.call(__method__)
16
14
  end
@@ -18,19 +16,15 @@ module Mutant
18
16
  # Stop master gracefully
19
17
  #
20
18
  # @return [self]
21
- #
22
- # @api private
23
19
  def stop
24
20
  binding.call(__method__)
25
21
  self
26
22
  end
27
23
  end # Driver
28
24
 
29
- # Run async computation returing driver
25
+ # Run async computation returning driver
30
26
  #
31
27
  # @return [Driver]
32
- #
33
- # @api private
34
28
  def self.async(config)
35
29
  Driver.new(config.env.new_mailbox.bind(Master.call(config)))
36
30
  end
@@ -44,43 +38,53 @@ module Mutant
44
38
  # @param [Object]
45
39
  #
46
40
  # @return [self]
47
- #
48
- # @api private
49
41
  abstract_method :result
50
42
 
51
43
  # Sink status
52
44
  #
53
45
  # @return [Object]
54
- #
55
- # @api private
56
46
  abstract_method :status
57
47
 
58
48
  # Test if processing should stop
59
49
  #
60
50
  # @return [Boolean]
61
- #
62
- # @api private
63
51
  abstract_method :stop?
64
52
  end # Sink
65
53
 
66
54
  # Job to push to workers
67
55
  class Job
68
- include Adamantium::Flat, Anima.new(:index, :payload)
56
+ include Adamantium::Flat, Anima.new(
57
+ :index,
58
+ :payload
59
+ )
69
60
  end # Job
70
61
 
71
62
  # Job result object received from workers
72
63
  class JobResult
73
- include Adamantium::Flat, Anima.new(:job, :payload)
64
+ include Adamantium::Flat, Anima.new(
65
+ :job,
66
+ :payload
67
+ )
74
68
  end # JobResult
75
69
 
76
70
  # Parallel run configuration
77
71
  class Config
78
- include Adamantium::Flat, Anima.new(:env, :processor, :source, :sink, :jobs)
72
+ include Adamantium::Flat, Anima.new(
73
+ :env,
74
+ :jobs,
75
+ :processor,
76
+ :sink,
77
+ :source
78
+ )
79
79
  end # Config
80
80
 
81
81
  # Parallel execution status
82
82
  class Status
83
- include Adamantium::Flat, Anima.new(:payload, :done, :active_jobs)
83
+ include Adamantium::Flat, Anima.new(
84
+ :active_jobs,
85
+ :done,
86
+ :payload
87
+ )
84
88
  end
85
89
 
86
90
  end # Parallel
@@ -11,8 +11,6 @@ module Mutant
11
11
  # @param [Config] config
12
12
  #
13
13
  # @return [Actor::Sender]
14
- #
15
- # @api private
16
14
  def self.call(config)
17
15
  config.env.spawn do |mailbox|
18
16
  new(config, mailbox).__send__(:run)
@@ -22,8 +20,6 @@ module Mutant
22
20
  # Initialize object
23
21
  #
24
22
  # @return [undefined]
25
- #
26
- # @api private
27
23
  def initialize(*)
28
24
  super
29
25
 
@@ -40,8 +36,6 @@ module Mutant
40
36
  # rubocop:disable MethodLength
41
37
  #
42
38
  # @return [undefined]
43
- #
44
- # @api private
45
39
  def run
46
40
  config.jobs.times do
47
41
  @workers += 1
@@ -69,8 +63,6 @@ module Mutant
69
63
  # @param [Actor::Message] message
70
64
  #
71
65
  # @return [undefined]
72
- #
73
- # @api private
74
66
  def handle(message)
75
67
  type, payload = message.type, message.payload
76
68
  method = MAP.fetch(type) do
@@ -82,8 +74,6 @@ module Mutant
82
74
  # Run receive loop
83
75
  #
84
76
  # @return [undefined]
85
- #
86
- # @api private
87
77
  def receive_loop
88
78
  handle(mailbox.receiver.call) until @workers.zero? && @stop
89
79
  end
@@ -93,8 +83,6 @@ module Mutant
93
83
  # @param [Actor::Sender] sender
94
84
  #
95
85
  # @return [undefined]
96
- #
97
- # @api private
98
86
  def handle_status(sender)
99
87
  status = Status.new(
100
88
  payload: sink.status,
@@ -109,8 +97,6 @@ module Mutant
109
97
  # @param [JobResult] job_result
110
98
  #
111
99
  # @return [undefined]
112
- #
113
- # @api private
114
100
  def handle_result(job_result)
115
101
  @active_jobs.delete(job_result.job)
116
102
  sink.result(job_result.payload)
@@ -121,8 +107,6 @@ module Mutant
121
107
  # @param [Actor::Sender] sender
122
108
  #
123
109
  # @return [undefined]
124
- #
125
- # @api private
126
110
  def handle_stop(sender)
127
111
  @stop = true
128
112
  receive_loop
@@ -134,8 +118,6 @@ module Mutant
134
118
  # @param [Actor::Sender] sender
135
119
  #
136
120
  # @return [undefined]
137
- #
138
- # @api private
139
121
  def handle_ready(sender)
140
122
  if stop_work?
141
123
  stop_worker(sender)
@@ -151,8 +133,6 @@ module Mutant
151
133
  # if next job is available
152
134
  #
153
135
  # @return [nil]
154
- #
155
- # @api private
156
136
  def next_job
157
137
  Job.new(
158
138
  index: @index,
@@ -168,8 +148,6 @@ module Mutant
168
148
  # @param [Actor::Sender] sender
169
149
  #
170
150
  # @return [undefined]
171
- #
172
- # @api private
173
151
  def stop_worker(sender)
174
152
  @workers -= 1
175
153
  sender.call(Actor::Message.new(:stop))
@@ -178,8 +156,6 @@ module Mutant
178
156
  # Test if scheduling stopped
179
157
  #
180
158
  # @return [Boolean]
181
- #
182
- # @api private
183
159
  def stop_work?
184
160
  @stop || !source.next? || sink.stop?
185
161
  end
@@ -187,8 +163,6 @@ module Mutant
187
163
  # Job source
188
164
  #
189
165
  # @return [Source]
190
- #
191
- # @api private
192
166
  def source
193
167
  config.source
194
168
  end
@@ -196,8 +170,6 @@ module Mutant
196
170
  # Job result sink
197
171
  #
198
172
  # @return [Sink]
199
- #
200
- # @api private
201
173
  def sink
202
174
  config.sink
203
175
  end
@@ -12,15 +12,11 @@ module Mutant
12
12
  #
13
13
  # @raise [NoJobError]
14
14
  # when no next job is available
15
- #
16
- # @api private
17
15
  abstract_method :next
18
16
 
19
17
  # Test if next job is available
20
18
  #
21
19
  # @return [Boolean]
22
- #
23
- # @api private
24
20
  abstract_method :next?
25
21
 
26
22
  # Job source backed by a finite array
@@ -30,8 +26,6 @@ module Mutant
30
26
  # Initialize objecto
31
27
  #
32
28
  # @return [undefined]
33
- #
34
- # @api private
35
29
  def initialize(*)
36
30
  super
37
31
 
@@ -41,8 +35,6 @@ module Mutant
41
35
  # Test if next job is available
42
36
  #
43
37
  # @return [Boolean]
44
- #
45
- # @api private
46
38
  def next?
47
39
  @next_index < jobs.length
48
40
  end
@@ -53,8 +45,6 @@ module Mutant
53
45
  #
54
46
  # @raise [NoJobError]
55
47
  # when no next job is available
56
- #
57
- # @api private
58
48
  def next
59
49
  fail NoJobError unless next?
60
50
  jobs.fetch(@next_index).tap do
@@ -2,15 +2,17 @@ module Mutant
2
2
  module Parallel
3
3
  # Parallel execution worker
4
4
  class Worker
5
- include Adamantium::Flat, Anima.new(:mailbox, :processor, :parent)
5
+ include Adamantium::Flat, Anima.new(
6
+ :mailbox,
7
+ :parent,
8
+ :processor
9
+ )
6
10
 
7
11
  # Run worker
8
12
  #
9
13
  # @param [Hash<Symbol, Object] attributes
10
14
  #
11
15
  # @return [self]
12
- #
13
- # @api private
14
16
  def self.run(attributes)
15
17
  new(attributes).run
16
18
  self
@@ -23,8 +25,6 @@ module Mutant
23
25
  # @return [self]
24
26
  #
25
27
  # rubocop:disable Lint/Loop
26
- #
27
- # @api private
28
28
  def run
29
29
  begin
30
30
  parent.call(Actor::Message.new(:ready, mailbox.sender))
@@ -38,8 +38,6 @@ module Mutant
38
38
  # @param [Message] message
39
39
  #
40
40
  # @return [Boolean]
41
- #
42
- # @api private
43
41
  def handle(message)
44
42
  type, payload = message.type, message.payload
45
43
  case message.type
@@ -58,11 +56,18 @@ module Mutant
58
56
  # @param [Job] job
59
57
  #
60
58
  # @return [undefined]
61
- #
62
- # @api private
63
59
  def handle_job(job)
64
60
  result = processor.call(job.payload)
65
- parent.call(Actor::Message.new(:result, JobResult.new(job: job, payload: result)))
61
+
62
+ parent.call(
63
+ Actor::Message.new(
64
+ :result,
65
+ JobResult.new(
66
+ job: job,
67
+ payload: result
68
+ )
69
+ )
70
+ )
66
71
  end
67
72
 
68
73
  end # Worker