tamashii 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5528eae49cee966009f8840079b125b2c58adae
4
- data.tar.gz: 86ab766be4d51d630d34a828bbd81ce1c67afb65
3
+ metadata.gz: 637575c817bd71e84045a69c5e5c3072ed5f3688
4
+ data.tar.gz: d268102ce32b07fc745f7a422552a5ce8860037a
5
5
  SHA512:
6
- metadata.gz: 3deb8659746182ef1dad7fb16d3ca6c0297fe518228be4528473d72af2e3d24e5c252c4fad94732b8959f45f39a016ab96f5905bcd9c50218310a507f7831b26
7
- data.tar.gz: d38fb81b52fc1c2100b19581acc03b98b631331329b2c8479598ab6044dc42f9611d8da7fb088fb3a436986cb4f83bb6d26337d669f3cf7b8029c5c46376ada5
6
+ metadata.gz: 85289e69ebb52ae24d099713519bd77f18d91de41ca1cb1b08a643123a1d4705202ea079774758cf2a2501ddfc1d731b2079576cd8f39daa9d62c3f483864f63
7
+ data.tar.gz: 9b7f4a4f4e3e9968bae607177544a10ff13679e77bab0f0c39caf9a8149ca233d50af0c4d20826e4dd8ae6dea1ab04476323088ed1b0eb5313f8b5022a72ed50
@@ -7,6 +7,7 @@ require 'websocket/driver'
7
7
  require 'rack'
8
8
  require 'nio'
9
9
  require 'thread'
10
+ require 'concurrent'
10
11
  require 'redis'
11
12
 
12
13
  module Tamashii
@@ -77,6 +77,10 @@ module Tamashii
77
77
  end
78
78
  end
79
79
 
80
+ def ping(data, &block)
81
+ @driver.ping(data, &block)
82
+ end
83
+
80
84
  def close
81
85
  # TODO: Define close reason / code
82
86
  @driver.close('', 1000)
@@ -18,6 +18,17 @@ module Tamashii
18
18
  @spawn_mutex = Mutex.new
19
19
  end
20
20
 
21
+ def timer(interval, &block)
22
+ Concurrent::TimerTask.new(
23
+ execution_interval: interval, &block
24
+ ).tap(&:execute)
25
+ end
26
+
27
+ def post(task = nil, &block)
28
+ task ||= block
29
+ Concurrent.global_io_executor << task
30
+ end
31
+
21
32
  def attach(io, stream)
22
33
  @todo << lambda do
23
34
  @streams[io] = @nio.register(io, :r)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tamashii
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tamashii
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - 蒼時弦也
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2017-05-23 00:00:00.000000000 Z
13
+ date: 2017-05-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: concurrent-ruby