devnull 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +6 -14
  2. data/History.txt +7 -0
  3. data/README.txt +38 -29
  4. data/lib/devnull.rb +142 -141
  5. metadata +18 -27
  6. data/.gemtest +0 -0
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjNkMmFiODI0YmMzNmQ5YWM3OTQ3YzY0NWQ4NTU3Mjk2MzdhYmI2Nw==
5
- data.tar.gz: !binary |-
6
- ZTdkNzAwMzAzZmY3ZjRlNmEyZjlhNTczYzEzMTBjMGM0ZDk0NGMyNQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- Y2ExMDFhNDZiZTk5NTZhMTNjZDViNWI1YTQ4NTRhYmY1OWQxODQ1ZjUxNDgw
10
- NWU3ODMxMzJhYmE1ZDE1YjMyNDNiMGM1OGE2OGJhY2U5NTVmYzk2MTVlYTI4
11
- NWFmMjM0YjA1Y2JmNGVkZmQ2YjJiZTJkZDM5NmFkNzRjM2Y1NDg=
12
- data.tar.gz: !binary |-
13
- ZGQ3N2QxYzg3Y2JlMThiOGU5N2RlNGFlZDJlZTQxYTc1MDk2MTk2ZTc4YzI0
14
- MTc5ZjUxNzI4YmIzNjE2MWZhNWIzODM4OGMxZjVkMGVkNGM0Nzg2OTQ0ZDhj
15
- MWQ3MDY5OGYwMTg0NzZhNDFiOWFhNWQyNTEzYTUyMGI0YWM5NGQ=
2
+ SHA1:
3
+ metadata.gz: ab9b2bd9353de1577f8f63817a253c45737ed89a
4
+ data.tar.gz: af8ebecb37ab062fdbfb1486b87fa3e07d626b2a
5
+ SHA512:
6
+ metadata.gz: a03f5dbdedf57b83c2754612b19bdc9f492369c87875b4572c29ea6449a6f58facd248161659606cb2c207807356c236ee15fb701413d0dc572896f77b0a27fa
7
+ data.tar.gz: abb6eb752a74ba70377f592f77600a67979ed17cd906a973bb7cfc74be307a5a1039854583e8be57873b8bbda28fa387259d4381c436d3a9152abdca561dec10
@@ -6,3 +6,10 @@
6
6
 
7
7
  * Fixed duplicated definition of DevNull#syswrite (Thanks Andrew Grimm!)
8
8
 
9
+ https://github.com/maraigue/devnull/pull/1
10
+
11
+ === 0.1.2 / 2015-02-20
12
+
13
+ * Moved the location of code 'VERSION = "A.B.C"' (Thanks Patrik Wenger!)
14
+
15
+ https://github.com/maraigue/devnull/commit/5c8d40b7e03c07a96ae647bc302eec74abfc224d#commitcomment-8379713
data/README.txt CHANGED
@@ -1,55 +1,64 @@
1
1
  = devnull
2
2
 
3
- http://github.com/maraigue/devnull
3
+ home :: https://rubygems.org/gems/devnull
4
+ code :: https://github.com/maraigue/devnull
5
+
6
+ == DESCRIPTION:
4
7
 
5
8
  Ruby implementation of null file (like /dev/null on Un*x, NUL on Windows)
6
9
 
7
- == DESCRIPTION:
10
+ == SYNOPSIS:
8
11
 
9
- DevNull behaves a null file, and works like an IO object. For example:
12
+ DevNull instance works like an IO object. For example:
10
13
 
11
- dn = DevNull.new
12
- dn.puts "foo" # => nil (do nothing)
13
- dn.gets # => nil
14
- dn.read # => ""
14
+ dn = DevNull.new
15
+ dn.puts "foo" # => nil (do nothing)
16
+ dn.gets # => nil
17
+ dn.read # => ""
15
18
 
16
19
  The library may be a good solution if you would like to switch whether an input/output file is needed. For example:
17
20
 
18
- def some_process(arg, logfile = nil)
19
- # You may set an IO object as 'logfile', and logs are written to the file.
20
-
21
- result = process1(arg)
22
- logfile.puts result if logfile
23
-
24
- result = process2(arg)
25
- logfile.puts result if logfile
26
-
27
- result = process3(arg)
28
- logfile.puts result if logfile
29
- end
21
+ def some_process(arg, logfile = nil)
22
+ # You may set an IO object as 'logfile'.
23
+ # If so, logs are written to the file.
24
+
25
+ result = process1(arg)
26
+ logfile.puts result if logfile
27
+
28
+ result = process2(arg)
29
+ logfile.puts result if logfile
30
+
31
+ result = process3(arg)
32
+ logfile.puts result if logfile
33
+ end
30
34
 
31
35
  can be rewritten as follows:
32
36
 
33
- def some_process(arg, logfile = DevNull.new)
34
- logfile.puts process1(arg)
35
- logfile.puts process2(arg)
36
- logfile.puts process3(arg)
37
- end
37
+ def some_process(arg, logfile = DevNull.new)
38
+ logfile.puts process1(arg)
39
+ logfile.puts process2(arg)
40
+ logfile.puts process3(arg)
41
+ end
38
42
 
39
- == INSTALL:
43
+ == INSTALLATION:
40
44
 
41
- gem install devnull
45
+ Installed by RubyGems with the command (recommended):
46
+
47
+ $ gem install devnull
48
+
49
+ Or you can use it with downloading devnull.rb file and load it by `require "./devnull"`.
42
50
 
43
51
  == DEVELOPERS:
44
52
 
53
+ (auto-generation by Hoe https://rubygems.org/gems/hoe)
54
+
45
55
  After checking out the source, run:
46
56
 
47
57
  $ rake newb
48
58
 
49
- This task will install any missing dependencies, run the tests/specs,
50
- and generate the RDoc.
59
+ This task will install any missing dependencies, run the tests/specs, and generate the RDoc.
51
60
 
52
- == LICENSE:
61
+ == LICENSE
53
62
 
54
63
  (The MIT License)
55
64
 
@@ -1,141 +1,142 @@
1
- # Ruby implementation of null file (like /dev/null on Un*x, NUL on Windows)
2
- # (C) 2010- H.Hiro(Maraigue) main@hhiro.net
3
- #
4
- # DevNull behaves a null file, and works like an IO object. For example:
5
- #
6
- # <pre>dn = DevNull.new
7
- # dn.puts "foo" # => nil (do nothing)
8
- # dn.gets # => nil
9
- # dn.read # => ""</pre>
10
- #
11
- # The library may be a good solution if you would like to switch whether an input/output file is needed. For example:
12
- #
13
- # <pre>def some_process(arg, logfile = nil)
14
- # # You may set an IO object as 'logfile', and logs are written to the file.
15
- #
16
- # result = process1(arg)
17
- # logfile.puts result if logfile
18
- #
19
- # result = process2(arg)
20
- # logfile.puts result if logfile
21
- #
22
- # result = process3(arg)
23
- # logfile.puts result if logfile
24
- # end</pre>
25
- #
26
- # can be rewritten as follows:
27
- #
28
- # <pre>def some_process(arg, logfile = DevNull.new)
29
- # logfile.puts process1(arg)
30
- # logfile.puts process2(arg)
31
- # logfile.puts process3(arg)
32
- # end</pre>
33
-
34
- require "enumerator"
35
- VERSION = "0.1.1"
36
-
37
- class DevNull
38
- def initialize
39
- # do nothing
40
- end
41
-
42
- # --
43
- # methods treated as being not implemented
44
- # ++
45
- def fileno; raise NotImplementedError; end
46
- alias :to_i :fileno
47
- def fsync; raise NotImplementedError; end
48
- def fdatasync; raise NotImplementedError; end
49
- def stat; raise NotImplementedError; end
50
- def fcntl(arg1, arg2); raise NotImplementedError; end
51
- def ioctl(arg1, arg2); raise NotImplementedError; end
52
-
53
- # --
54
- # methods that do nothing
55
- # ++
56
- def close; end
57
- def close_read; end
58
- def close_write; end
59
- def print(*args); end
60
- def printf(arg1, *other_args); end
61
- def puts(*args); end
62
- def ungetbyte(arg); end
63
- def ungetc(arg); end
64
-
65
- # --
66
- # methods that do nothing and returns something
67
- # ++
68
- def getc; nil; end
69
- def getbyte; nil; end
70
- def gets(arg1=nil, arg2=nil); nil; end
71
- def path; nil; end
72
- def pid; nil; end
73
- def external_encoding; nil; end
74
- def internal_encoding; nil; end
75
-
76
- def to_io; self; end
77
- def <<(obj); self; end
78
- def binmode; self; end
79
- def flush; self; end
80
- def reopen(arg1, arg2=nil); self; end
81
- def set_encoding(arg1, arg2=nil, arg3=nil); self; end
82
-
83
- def autoclose?; true; end
84
- def binmode?; true; end
85
- def closed?; true; end
86
- def eof; true; end
87
- def eof?; true; end
88
- def sync; true; end
89
-
90
- def close_on_exec?; false; end
91
- def closed_read?; false; end
92
- def closed_write?; false; end
93
- def isatty; false; end
94
- def tty?; false; end
95
-
96
- def lineno; 0; end
97
- def pos; 0; end
98
- def tell; 0; end
99
- def rewind; 0; end
100
- def seek(arg1, arg2=nil); 0; end
101
- def sysseek(arg1, arg2=nil); 0; end
102
-
103
- def readlines(arg1=nil, arg2=nil); []; end
104
-
105
- def putc(arg); arg; end
106
- def autoclose=(arg); arg; end
107
- def close_on_exec=(arg); arg; end
108
- def lineno=(arg); arg; end
109
- def pos=(arg); arg; end
110
- def sync=(arg); arg; end
111
- def truncate(arg); arg; end
112
- def write(arg); arg.to_s.length; end
113
- def syswrite(arg); arg.to_s.length; end
114
- def write_nonblock(arg); arg.to_s.length; end
115
-
116
- def each(*args); (block_given? ? self : [].to_enum); end
117
- alias :each_line :each
118
- alias :lines :each
119
- alias :each_byte :each
120
- alias :bytes :each
121
- alias :each_char :each
122
- alias :chars :each
123
- alias :each_codepoint :each
124
- alias :codepoints :each
125
-
126
- def sysread(arg1, arg2=nil); raise EOFError; end
127
- def readpartial(arg1, arg2=nil); raise EOFError; end
128
- def read_nonblock(arg1, arg2=nil); raise EOFError; end
129
- def readchar; raise EOFError; end
130
- def readbyte; raise EOFError; end
131
- def readline(arg1=nil, arg2=nil); raise EOFError; end
132
-
133
- def read(len = 0, outbuf = nil)
134
- if outbuf != nil
135
- outbuf.replace("")
136
- outbuf
137
- else
138
- (len.to_i == 0 ? "" : nil)
139
- end
140
- end
141
- end
1
+ # Ruby implementation of null file (like /dev/null on Un*x, NUL on Windows)
2
+ # (C) 2010- H.Hiro(Maraigue) main@hhiro.net
3
+ #
4
+ # DevNull behaves a null file, and works like an IO object. For example:
5
+ #
6
+ # <pre>dn = DevNull.new
7
+ # dn.puts "foo" # => nil (do nothing)
8
+ # dn.gets # => nil
9
+ # dn.read # => ""</pre>
10
+ #
11
+ # The library may be a good solution if you would like to switch whether an input/output file is needed. For example:
12
+ #
13
+ # <pre>def some_process(arg, logfile = nil)
14
+ # # You may set an IO object as 'logfile', and logs are written to the file.
15
+ #
16
+ # result = process1(arg)
17
+ # logfile.puts result if logfile
18
+ #
19
+ # result = process2(arg)
20
+ # logfile.puts result if logfile
21
+ #
22
+ # result = process3(arg)
23
+ # logfile.puts result if logfile
24
+ # end</pre>
25
+ #
26
+ # can be rewritten as follows:
27
+ #
28
+ # <pre>def some_process(arg, logfile = DevNull.new)
29
+ # logfile.puts process1(arg)
30
+ # logfile.puts process2(arg)
31
+ # logfile.puts process3(arg)
32
+ # end</pre>
33
+
34
+ require "enumerator"
35
+
36
+ class DevNull
37
+ VERSION = "0.1.2"
38
+
39
+ def initialize
40
+ # do nothing
41
+ end
42
+
43
+ # --
44
+ # methods treated as being not implemented
45
+ # ++
46
+ def fileno; raise NotImplementedError; end
47
+ alias :to_i :fileno
48
+ def fsync; raise NotImplementedError; end
49
+ def fdatasync; raise NotImplementedError; end
50
+ def stat; raise NotImplementedError; end
51
+ def fcntl(arg1, arg2); raise NotImplementedError; end
52
+ def ioctl(arg1, arg2); raise NotImplementedError; end
53
+
54
+ # --
55
+ # methods that do nothing
56
+ # ++
57
+ def close; end
58
+ def close_read; end
59
+ def close_write; end
60
+ def print(*args); end
61
+ def printf(arg1, *other_args); end
62
+ def puts(*args); end
63
+ def ungetbyte(arg); end
64
+ def ungetc(arg); end
65
+
66
+ # --
67
+ # methods that do nothing and returns something
68
+ # ++
69
+ def getc; nil; end
70
+ def getbyte; nil; end
71
+ def gets(arg1=nil, arg2=nil); nil; end
72
+ def path; nil; end
73
+ def pid; nil; end
74
+ def external_encoding; nil; end
75
+ def internal_encoding; nil; end
76
+
77
+ def to_io; self; end
78
+ def <<(obj); self; end
79
+ def binmode; self; end
80
+ def flush; self; end
81
+ def reopen(arg1, arg2=nil); self; end
82
+ def set_encoding(arg1, arg2=nil, arg3=nil); self; end
83
+
84
+ def autoclose?; true; end
85
+ def binmode?; true; end
86
+ def closed?; true; end
87
+ def eof; true; end
88
+ def eof?; true; end
89
+ def sync; true; end
90
+
91
+ def close_on_exec?; false; end
92
+ def closed_read?; false; end
93
+ def closed_write?; false; end
94
+ def isatty; false; end
95
+ def tty?; false; end
96
+
97
+ def lineno; 0; end
98
+ def pos; 0; end
99
+ def tell; 0; end
100
+ def rewind; 0; end
101
+ def seek(arg1, arg2=nil); 0; end
102
+ def sysseek(arg1, arg2=nil); 0; end
103
+
104
+ def readlines(arg1=nil, arg2=nil); []; end
105
+
106
+ def putc(arg); arg; end
107
+ def autoclose=(arg); arg; end
108
+ def close_on_exec=(arg); arg; end
109
+ def lineno=(arg); arg; end
110
+ def pos=(arg); arg; end
111
+ def sync=(arg); arg; end
112
+ def truncate(arg); arg; end
113
+ def write(arg); arg.to_s.length; end
114
+ def syswrite(arg); arg.to_s.length; end
115
+ def write_nonblock(arg); arg.to_s.length; end
116
+
117
+ def each(*args); (block_given? ? self : [].to_enum); end
118
+ alias :each_line :each
119
+ alias :lines :each
120
+ alias :each_byte :each
121
+ alias :bytes :each
122
+ alias :each_char :each
123
+ alias :chars :each
124
+ alias :each_codepoint :each
125
+ alias :codepoints :each
126
+
127
+ def sysread(arg1, arg2=nil); raise EOFError; end
128
+ def readpartial(arg1, arg2=nil); raise EOFError; end
129
+ def read_nonblock(arg1, arg2=nil); raise EOFError; end
130
+ def readchar; raise EOFError; end
131
+ def readbyte; raise EOFError; end
132
+ def readline(arg1=nil, arg2=nil); raise EOFError; end
133
+
134
+ def read(len = 0, outbuf = nil)
135
+ if outbuf != nil
136
+ outbuf.replace("")
137
+ outbuf
138
+ else
139
+ (len.to_i == 0 ? "" : nil)
140
+ end
141
+ end
142
+ end
metadata CHANGED
@@ -1,53 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devnull
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
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: 2013-06-27 00:00:00.000000000 Z
11
+ date: 2015-02-20 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
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: hoe
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.6'
33
+ version: '3.13'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.6'
41
- description: ! "DevNull behaves a null file, and works like an IO object. For example:\n\n
42
- dn = DevNull.new\n dn.puts \"foo\" # => nil (do nothing)\n dn.gets # => nil\n dn.read
43
- # => \"\"\n\nThe library may be a good solution if you would like to switch whether
44
- an input/output file is needed. For example:\n\n def some_process(arg, logfile =
45
- nil)\n # You may set an IO object as 'logfile', and logs are written to the file.\n
46
- \ \n result = process1(arg)\n logfile.puts result if logfile\n \n result
47
- = process2(arg)\n logfile.puts result if logfile\n \n result = process3(arg)\n
48
- \ logfile.puts result if logfile\n end\n\ncan be rewritten as follows:\n\n def
49
- some_process(arg, logfile = DevNull.new)\n logfile.puts process1(arg)\n logfile.puts
50
- process2(arg)\n logfile.puts process3(arg)\n end"
40
+ version: '3.13'
41
+ description: Ruby implementation of null file (like /dev/null on Un*x, NUL on Windows)
51
42
  email:
52
43
  - main@hhiro.net
53
44
  executables: []
@@ -61,30 +52,30 @@ files:
61
52
  - lib/devnull.rb
62
53
  - spec/devnull_spec.rb
63
54
  - spec/spec_helper.rb
64
- - .gemtest
65
- homepage: http://github.com/maraigue/devnull
66
- licenses: []
55
+ homepage: https://rubygems.org/gems/devnull
56
+ licenses:
57
+ - MIT
67
58
  metadata: {}
68
59
  post_install_message:
69
60
  rdoc_options:
70
- - --main
61
+ - "--main"
71
62
  - README.txt
72
63
  require_paths:
73
64
  - lib
74
65
  required_ruby_version: !ruby/object:Gem::Requirement
75
66
  requirements:
76
- - - ! '>='
67
+ - - ">="
77
68
  - !ruby/object:Gem::Version
78
69
  version: '0'
79
70
  required_rubygems_version: !ruby/object:Gem::Requirement
80
71
  requirements:
81
- - - ! '>='
72
+ - - ">="
82
73
  - !ruby/object:Gem::Version
83
74
  version: '0'
84
75
  requirements: []
85
- rubyforge_project: devnull
86
- rubygems_version: 2.0.3
76
+ rubyforge_project:
77
+ rubygems_version: 2.4.5
87
78
  signing_key:
88
79
  specification_version: 4
89
- summary: DevNull behaves a null file, and works like an IO object
80
+ summary: Ruby implementation of null file (like /dev/null on Un*x, NUL on Windows)
90
81
  test_files: []
data/.gemtest DELETED
File without changes