saorin 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,12 +9,14 @@ module Saorin
9
9
  'Content-Type' => 'application/json'
10
10
  }.freeze
11
11
 
12
+ attr_reader :server
13
+
12
14
  def initialize(handler, options = {}, &block)
13
15
  super handler, options
14
16
 
15
- server = ::Reel::Server.supervise(options[:host], options[:port], &method(:process))
16
- trap(:INT) { server.terminate; exit }
17
- sleep
17
+ @server = ::Reel::Server.supervise(options[:host], options[:port], &method(:process))
18
+ trap(:INT) { @server.terminate; exit }
19
+ sleep unless options[:nonblock]
18
20
  end
19
21
 
20
22
  def process(connection)
@@ -18,7 +18,7 @@ module Saorin
18
18
  end
19
19
 
20
20
  def valid?
21
- return false unless (@result || @error) && !(@result && @error)
21
+ return false unless !(@result && @error)
22
22
  return false unless [String].any? { |type| @version.is_a? type }
23
23
  return false unless [String, NilClass].any? { |type| @result.is_a? type }
24
24
  return false unless [Saorin::Error, Hash, NilClass].any? { |type| @error.is_a? type }
@@ -1,3 +1,3 @@
1
1
  module Saorin
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
data/server.rb ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- encoding: utf-8 -*-
3
+ require 'saorin'
4
+
5
+ class Handler
6
+ def log(tag, time, record)
7
+ puts [tag, time, record]
8
+ nil
9
+ end
10
+ end
11
+
12
+ Saorin::Server.start Handler.new, :host => 'localhost', :port => 25252, :adapter => :reel
13
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saorin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-04 00:00:00.000000000 Z
12
+ date: 2013-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -89,6 +89,7 @@ files:
89
89
  - lib/saorin/server.rb
90
90
  - lib/saorin/version.rb
91
91
  - saorin.gemspec
92
+ - server.rb
92
93
  - spec/adapter/base_spec.rb
93
94
  - spec/request_spec.rb
94
95
  - spec/response_spec.rb
@@ -108,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
109
  version: '0'
109
110
  segments:
110
111
  - 0
111
- hash: 4075049932842170973
112
+ hash: 2090599809932543204
112
113
  required_rubygems_version: !ruby/object:Gem::Requirement
113
114
  none: false
114
115
  requirements:
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  version: '0'
118
119
  segments:
119
120
  - 0
120
- hash: 4075049932842170973
121
+ hash: 2090599809932543204
121
122
  requirements: []
122
123
  rubyforge_project:
123
124
  rubygems_version: 1.8.24