diff --git a/lib/hydra/message.rb b/lib/hydra/message.rb index a1c0d6d..c2cb9b3 100644 --- a/lib/hydra/message.rb +++ b/lib/hydra/message.rb @@ -1,5 +1,10 @@ module Hydra #:nodoc: class Message #:nodoc: + def initialize(opts = {}) + opts.each do |k,v| + self.send(k,v) + end + end def self.build(hash) hash.delete(:class).new(hash) end diff --git a/lib/hydra/runner.rb b/lib/hydra/runner.rb index c809162..83d521d 100644 --- a/lib/hydra/runner.rb +++ b/lib/hydra/runner.rb @@ -2,7 +2,7 @@ module Hydra #:nodoc: class Runner def initialize(io) @io = io - @io.write Hydra::Messages::RunnerRequestsFile.new.serialize + @io.write Hydra::Messages::RunnerRequestsFile.new end end end diff --git a/test/test_runner.rb b/test/test_runner.rb index 46c3c49..94799ec 100644 --- a/test/test_runner.rb +++ b/test/test_runner.rb @@ -11,8 +11,7 @@ class TestRunner < Test::Unit::TestCase @pipe.identify_as_parent end should "request a file on boot" do - @message = Hydra::Message.build(@pipe.gets) - assert @message.is_a?(Hydra::Messages::RunnerRequestsFile) + assert @pipe.gets.is_a?(Hydra::Messages::RunnerRequestsFile) end should "return a result message after processing a file" do