lib/tap/app.rb in bahuvrihi-tap-0.11.2 vs lib/tap/app.rb in bahuvrihi-tap-0.12.0
- old
+ new
@@ -104,13 +104,12 @@
#
# add_one = Tap::Task.intern({}, 'add_one') {|task, input| input += 1 }
# add_five = Tap::Task.intern({}, 'add_five') {|task, input| input += 5 }
#
# add_one.on_complete do |_result|
- # # _result is the audit; use the _current method
- # # to get the current value in the audit trail
- # current_value = _result._current
+ # # _result is the audit
+ # current_value = _result.value
#
# if current_value < 3
# add_one.enq(_result)
# else
# add_five.enq(_result)
@@ -126,38 +125,28 @@
#
# Although the results are indistinguishable, each achieved the final value
# through a different series of tasks. With auditing you can see how each
# input came to the final value of 8:
#
- # # app.results returns the actual result values
- # # app._results returns the audits for these values
- # app._results(add_five).each do |_result|
- # puts "How #{_result._original} became #{_result._current}:"
- # puts _result._to_s
- # puts
- # end
+ # "\n" + Tap::Support::Audit.dump(app._results(add_five), "")
+ # # => %Q{
+ # # o-[] 2
+ # # o-[add_one] 3
+ # # o-[add_five] 8
+ # #
+ # # o-[] 1
+ # # o-[add_one] 2
+ # # o-[add_one] 3
+ # # o-[add_five] 8
+ # #
+ # # o-[] 0
+ # # o-[add_one] 1
+ # # o-[add_one] 2
+ # # o-[add_one] 3
+ # # o-[add_five] 8
+ # # }
#
- # Prints:
- #
- # How 2 became 8:
- # o-[] 2
- # o-[add_one] 3
- # o-[add_five] 8
- #
- # How 1 became 8:
- # o-[] 1
- # o-[add_one] 2
- # o-[add_one] 3
- # o-[add_five] 8
- #
- # How 0 became 8:
- # o-[] 0
- # o-[add_one] 1
- # o-[add_one] 2
- # o-[add_one] 3
- # o-[add_five] 8
- #
# See Tap::Support::Audit for more details.
class App < Root
class << self
# Sets the current app instance
attr_writer :instance
@@ -376,12 +365,13 @@
# app.run
# app.results(t0, t1.batch) # => ["0.0", "1.1", "1.2"]
# app.results(t1, t0) # => ["1.1", "0.0"]
#
def results(*tasks)
- _results(tasks).collect {|_result| _result._current}
+ _results(tasks).collect {|_result| _result.value }
end
+ # Returns a string like: "#<Tap::App:#{object_id} root: #{root} >"
def inspect
"#<#{self.class.to_s}:#{object_id} root: #{root} >"
end
# TerminateErrors are raised to kill executing tasks when terminate is
\ No newline at end of file