Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Moved over to throw/catch event chain halting. (Thanks, Brian!)
Browse files Browse the repository at this point in the history
  • Loading branch information
codahale committed May 20, 2008
1 parent edd7bdc commit fe51f67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions lib/ropen/events/abstract_event.rb
Expand Up @@ -7,35 +7,35 @@ class Ropen::Events::AbstractEvent
# An event called when the child process is started.
#
# @param [Ropen::Command] command The command instance that has started.
# @return [Boolean] If +false+, the callback chain is halted.
# @throw [Symbol] If +:halt+, the callback chain is halted.
def start(command)
return true
# called when the process starts
end

# An event called when the child process has finished.
#
# @param [Ropen::Command] command The command instance that has finished.
# @return [Boolean] If +false+, the callback chain is halted.
# @throw If +:halt+, the callback chain is halted.
def finish(command)
return true
# called when the process finishes
end

# An event called when the child process writes to +STDOUT+.
#
# @param [Ropen::Command] command The command instance that is running.
# @param [String] data The output of the child process on +STDOUT+.
# @return [Boolean] If +false+, the callback chain is halted.
# @throw If +:halt+, the callback chain is halted.
def stdout(command, data)
return true
# called when the process writes to STDOUT
end

# An event called when the child process writes to +STDERR+.
#
# @param [Ropen::Command] command The command instance that is running.
# @param [String] data The output of the child process on +STDERR+.
# @return [Boolean] If +false+, the callback chain is halted.
# @throw If +:halt+, the callback chain is halted.
def stderr(command, data)
return true
# called when the process writes to STDERR
end

end
8 changes: 4 additions & 4 deletions spec/ropen/events/abstract_event_spec.rb
Expand Up @@ -9,19 +9,19 @@
end

it "should do nothing on starting" do
@event.start(@cmd).should == true
lambda { @event.start(@cmd) }.should_not throw_symbol(:halt)
end

it "should do nothing on finishing" do
@event.finish(@cmd).should == true
lambda { @event.finish(@cmd) }.should_not throw_symbol(:halt)
end

it "should do nothing on stdout output" do
@event.stdout(@cmd, @data).should == true
lambda { @event.stdout(@cmd, @data) }.should_not throw_symbol(:halt)
end

it "should do nothing on stderr output" do
@event.stderr(@cmd, @data).should == true
lambda { @event.stderr(@cmd, @data) }.should_not throw_symbol(:halt)
end

end

0 comments on commit fe51f67

Please sign in to comment.