midori-contrib 0.0.2 → 0.1.0

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: cadddcc567b3ab5a97cfdcec2fb36682f43c0702
4
- data.tar.gz: 625e91eff21ba060065dfe10a6034de1bd4ddf5e
3
+ metadata.gz: 3ec714a6aa1722648a8a599034891aed049db61d
4
+ data.tar.gz: 766542c9806b43408d522aac82d062db79a6536c
5
5
  SHA512:
6
- metadata.gz: e70ecc877cf7f532071e2c21afb2e58313d32df77845918a18a79745cb3b355d94a1583ecd9643d767d5f1458cd29aaf7b7168e6cec2e163a873fa7b15450fa4
7
- data.tar.gz: a7ef4a9aa0adab65f63b6c1b3589ce130c99dc21046eed50a83c52713224f3893984d3ce2ef63d6b6e1eb893d2acfc3fb2bf8bfbec0117843a5aeb5bf443eab4
6
+ metadata.gz: 9b38aee10d497ecac9a8131eff3823ab0a3ffb6ca28853b11fac98fb239b50c483d9a52aa254c48964c3446283421eccfcb7ca891ac961b4e5296e8a1135de68
7
+ data.tar.gz: ca270cc232ad97a1cdd1352e8430c80e3e2a8ed552c941005b3623eba53e3749dfec27a3aba4eb483beacc0755f2441a52b96e27392eae0f486a915997d7b054
@@ -1,5 +1,11 @@
1
- # Midori Contrib Module
2
- module MidoriContrib
3
- # Current Version Code
4
- VERSION = '0.0.2'.freeze
1
+ # Midori Module
2
+ module Midori
3
+ # Midori Contrib Module
4
+ module Contrib
5
+ # Current Version Code
6
+ VERSION = '0.1.0'.freeze
7
+ end
5
8
  end
9
+
10
+ # For API backward compatibility
11
+ MidoriContrib = Midori::Contrib
@@ -1,53 +1,55 @@
1
1
  ##
2
2
  # Midori Extension of File reading and writing
3
- module MidoriContrib
4
- class File
5
- # Init File object
6
- # @param [Array] args same args like File.new
7
- def initialize(*args)
8
- @file = ::File.new(*args)
9
- end
3
+ module Midori
4
+ module Contrib
5
+ class File
6
+ # Init File object
7
+ # @param [Array] args same args like File.new
8
+ def initialize(*args)
9
+ @file = ::File.new(*args)
10
+ end
10
11
 
11
- # read file
12
- # @return [String] string readed
13
- def read
14
- await(Promise.new do |resolve|
15
- data = ''
16
- EventLoop.register(@file, :r) do
17
- if @file.eof?
18
- EventLoop.deregister(@file)
19
- resolve.call(data)
20
- else
21
- data << @file.read_nonblock(16384)
12
+ # read file
13
+ # @return [String] string readed
14
+ def read
15
+ await(Promise.new do |resolve|
16
+ data = ''
17
+ EventLoop.register(@file, :r) do
18
+ if @file.eof?
19
+ EventLoop.deregister(@file)
20
+ resolve.call(data)
21
+ else
22
+ data << @file.read_nonblock(16384)
23
+ end
22
24
  end
23
- end
24
- end)
25
- end
25
+ end)
26
+ end
26
27
 
27
- # write file
28
- # @param [String] data string to be written
29
- def write(data)
30
- await(Promise.new do |resolve|
31
- written = 0
32
- EventLoop.register(@file, :w) do
33
- written += @file.write_nonblock(data[written..-1])
34
- if written == data.size
35
- EventLoop.deregister(@file)
36
- resolve.call(written)
28
+ # write file
29
+ # @param [String] data string to be written
30
+ def write(data)
31
+ await(Promise.new do |resolve|
32
+ written = 0
33
+ EventLoop.register(@file, :w) do
34
+ written += @file.write_nonblock(data[written..-1])
35
+ if written == data.size
36
+ EventLoop.deregister(@file)
37
+ resolve.call(written)
38
+ end
37
39
  end
38
- end
39
- end)
40
- end
40
+ end)
41
+ end
41
42
 
42
- # raw file object
43
- # @return [File] file
44
- def raw
45
- @file
46
- end
43
+ # raw file object
44
+ # @return [File] file
45
+ def raw
46
+ @file
47
+ end
47
48
 
48
- # Close the file
49
- def close
50
- @file.close
49
+ # Close the file
50
+ def close
51
+ @file.close
52
+ end
51
53
  end
52
54
  end
53
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midori-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - HeckPsi Lab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-28 00:00:00.000000000 Z
11
+ date: 2017-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-midori