devnull 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/History.txt +4 -0
- data/{README.txt → README.md} +100 -84
- data/lib/devnull.rb +1 -1
- metadata +18 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 30a3665b27660f382a7d97f7f49b7a13def698682d58cfec2cd253820f29acc9
|
4
|
+
data.tar.gz: a777f742513fd6a881ce8517a1a968c70e0b87b51ca56c6a88bacdae126e4941
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88cbca218e8ac9a1318b92e7b91d3723470ac49f95ea0bb85d0d39719f9c6a72e9c90a00dbe5b46c128872e9c47169dc1560de846f619d58263e6ff013441324
|
7
|
+
data.tar.gz: 299c4bac1b8cdc5827c39f25acc48080cc5362578f2c97380871c04e956634c68bee1dfea36141724ebf2b65eb62d6aa17d53ddbbb1a1f0b110efbac65f15aa2
|
data/History.txt
CHANGED
@@ -13,3 +13,7 @@ https://github.com/maraigue/devnull/pull/1
|
|
13
13
|
* Moved the location of code 'VERSION = "A.B.C"' (Thanks Patrik Wenger!)
|
14
14
|
|
15
15
|
https://github.com/maraigue/devnull/commit/5c8d40b7e03c07a96ae647bc302eec74abfc224d#commitcomment-8379713
|
16
|
+
|
17
|
+
=== 0.1.3 / 2019-05-24
|
18
|
+
|
19
|
+
* Updated the document
|
data/{README.txt → README.md}
RENAMED
@@ -1,84 +1,100 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
(
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
1
|
+
# devnull
|
2
|
+
|
3
|
+
website :: http://rubygems.org/gems/devnull
|
4
|
+
|
5
|
+
Source code / Documentation :: https://github.com/maraigue/devnull
|
6
|
+
|
7
|
+
## Description
|
8
|
+
|
9
|
+
Ruby implementation of null file (like /dev/null on Un*x, NUL on Windows)
|
10
|
+
|
11
|
+
## Note
|
12
|
+
|
13
|
+
You can do the similar with a built-in constant [File::NULL](https://docs.ruby-lang.org/ja/latest/method/File=3a=3aConstants/c/NULL.html): the object `open(File::NULL, "rw")` behaves almost the same as the object `DevNull.new`.
|
14
|
+
|
15
|
+
After the library is developed ([at Ruby 1.9.3](https://svn.ruby-lang.org/repos/ruby/tags/v1_9_3_0/NEWS)), Ruby introduced the built-in constant `File::NULL` that represents the *name* of the (environment-dependent) null file.
|
16
|
+
Notice that, different from `open(File::NULL, "rw")`, `DevNull.new` does *not* use file-opening API.
|
17
|
+
|
18
|
+
## Synopsis
|
19
|
+
|
20
|
+
DevNull instance works like an IO object. For example:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
dn = DevNull.new
|
24
|
+
dn.puts "foo" # => nil (do nothing)
|
25
|
+
dn.gets # => nil
|
26
|
+
dn.read # => ""
|
27
|
+
```
|
28
|
+
|
29
|
+
The library may be a good solution if you would like to switch whether an input/output file is needed. For example:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
def some_process(arg, logfile = nil)
|
33
|
+
# You may set an IO object as 'logfile'.
|
34
|
+
# If so, logs are written to the file.
|
35
|
+
|
36
|
+
result = process1(arg)
|
37
|
+
logfile.puts result if logfile
|
38
|
+
|
39
|
+
result = process2(arg)
|
40
|
+
logfile.puts result if logfile
|
41
|
+
|
42
|
+
result = process3(arg)
|
43
|
+
logfile.puts result if logfile
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
can be rewritten as follows:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
def some_process(arg, logfile = DevNull.new)
|
51
|
+
logfile.puts process1(arg)
|
52
|
+
logfile.puts process2(arg)
|
53
|
+
logfile.puts process3(arg)
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
## Installation
|
58
|
+
|
59
|
+
Installed by RubyGems with the command (recommended):
|
60
|
+
|
61
|
+
$ gem install devnull
|
62
|
+
|
63
|
+
Or you can use it with downloading devnull.rb file and load it by `require "./devnull"`.
|
64
|
+
|
65
|
+
## Developers
|
66
|
+
|
67
|
+
(auto-generation by Hoe https://rubygems.org/gems/hoe)
|
68
|
+
|
69
|
+
After checking out the source, run:
|
70
|
+
|
71
|
+
```sh
|
72
|
+
$ rake newb
|
73
|
+
```
|
74
|
+
|
75
|
+
This task will install any missing dependencies, run the tests/specs, and generate the RDoc.
|
76
|
+
|
77
|
+
## License
|
78
|
+
|
79
|
+
(The MIT License)
|
80
|
+
|
81
|
+
Copyright (c) 2011- H.Hiro (Maraigue)
|
82
|
+
|
83
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
84
|
+
a copy of this software and associated documentation files (the
|
85
|
+
"Software"), to deal in the Software without restriction, including
|
86
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
87
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
88
|
+
permit persons to whom the Software is furnished to do so, subject to
|
89
|
+
the following conditions:
|
90
|
+
|
91
|
+
The above copyright notice and this permission notice shall be
|
92
|
+
included in all copies or substantial portions of the Software.
|
93
|
+
|
94
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
95
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
96
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
97
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
98
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
99
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
100
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/devnull.rb
CHANGED
metadata
CHANGED
@@ -1,65 +1,70 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devnull
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- H.Hiro (maraigue)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '7'
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '4.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '7'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: hoe
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '3.
|
39
|
+
version: '3.17'
|
34
40
|
type: :development
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3.
|
46
|
+
version: '3.17'
|
41
47
|
description: Ruby implementation of null file (like /dev/null on Un*x, NUL on Windows)
|
42
|
-
email:
|
43
|
-
- main@hhiro.net
|
48
|
+
email: main@hhiro.net
|
44
49
|
executables: []
|
45
50
|
extensions: []
|
46
51
|
extra_rdoc_files:
|
47
52
|
- History.txt
|
48
|
-
- README.
|
53
|
+
- README.md
|
49
54
|
files:
|
50
55
|
- History.txt
|
51
|
-
- README.
|
56
|
+
- README.md
|
52
57
|
- lib/devnull.rb
|
53
58
|
- spec/devnull_spec.rb
|
54
59
|
- spec/spec_helper.rb
|
55
|
-
homepage:
|
60
|
+
homepage: http://rubygems.org/gems/devnull
|
56
61
|
licenses:
|
57
62
|
- MIT
|
58
63
|
metadata: {}
|
59
64
|
post_install_message:
|
60
65
|
rdoc_options:
|
61
66
|
- "--main"
|
62
|
-
- README.
|
67
|
+
- README.md
|
63
68
|
require_paths:
|
64
69
|
- lib
|
65
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -73,8 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
78
|
- !ruby/object:Gem::Version
|
74
79
|
version: '0'
|
75
80
|
requirements: []
|
76
|
-
|
77
|
-
rubygems_version: 2.4.5
|
81
|
+
rubygems_version: 3.0.3
|
78
82
|
signing_key:
|
79
83
|
specification_version: 4
|
80
84
|
summary: Ruby implementation of null file (like /dev/null on Un*x, NUL on Windows)
|