supplement 2.7 → 2.12
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 +4 -4
- data/README +1 -1
- data/lib/Rakefile +1 -1
- data/lib/mkrf_conf +16 -12
- data/lib/supplement.c +22 -3
- data/lib/supplement.h +3 -2
- data/lib/supplement/date.rb +20 -0
- data/lib/supplement/locked.c +4 -0
- data/lib/supplement/terminal.c +4 -4
- data/lib/supplement/terminal.h +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf8795db0b5ca032a21f2c9d6c094000045ba76d82bf2f02f454f3b040c7892c
|
4
|
+
data.tar.gz: da36d7c646e056c082d2ac66b62a9025b33730f5baac26b412816fb8f6c37fca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 833fe634e70363e0d6ba5336f52c526b36680a2dd264c635dcd1a01ad54ddbc567a5e7080a2b8e40e1e34025fadb7a07b274e0d4a988972cd69cfd45865adff3
|
7
|
+
data.tar.gz: 14eab88565eca8d88a7144d9a00f2ced1c7b9f38d6427bc96daa833a50a5fe5001bf85e1557bfc48b85f8951928dad1fa1959c58e151344474c386acf8dc944a
|
data/README
CHANGED
data/lib/Rakefile
CHANGED
data/lib/mkrf_conf
CHANGED
@@ -10,21 +10,25 @@ Autorake.configure {
|
|
10
10
|
|
11
11
|
extending_ruby
|
12
12
|
|
13
|
-
if RUBY_VERSION < "2.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
if RUBY_VERSION < "2.7" then
|
14
|
+
if RUBY_VERSION < "2.6" then
|
15
|
+
enable :dir_children
|
16
|
+
if RUBY_VERSION < "1.9.2" then
|
17
|
+
enable :array_select_bang
|
18
|
+
if RUBY_VERSION < "1.9" then
|
19
|
+
enable :string_ord
|
20
|
+
enable :string_clear
|
21
|
+
if RUBY_VERSION < "1.8.7" then
|
22
|
+
enable :array_index_with_block
|
23
|
+
enable :kernel_tap
|
24
|
+
enable :string_start_with
|
25
|
+
enable :thread_exclusive
|
26
|
+
end
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
30
|
+
else
|
31
|
+
enable :super_kwargs
|
28
32
|
end
|
29
33
|
|
30
34
|
if RUBY_VERSION < "1.9" then
|
data/lib/supplement.c
CHANGED
@@ -171,6 +171,24 @@ rb_krn_tap_bang( VALUE obj)
|
|
171
171
|
}
|
172
172
|
|
173
173
|
|
174
|
+
/*
|
175
|
+
* call-seq:
|
176
|
+
* with { |x| ... } -> obj
|
177
|
+
*
|
178
|
+
* Yields +x+ to the block.
|
179
|
+
* This difference to +tap+ is that the block's result will be returned.
|
180
|
+
*
|
181
|
+
* Use this to narrow your namespace.
|
182
|
+
*
|
183
|
+
*/
|
184
|
+
|
185
|
+
VALUE
|
186
|
+
rb_krn_with( VALUE obj)
|
187
|
+
{
|
188
|
+
return rb_yield( obj);
|
189
|
+
}
|
190
|
+
|
191
|
+
|
174
192
|
/*
|
175
193
|
* Document-class: NilClass
|
176
194
|
*/
|
@@ -1226,7 +1244,7 @@ rb_file_size( VALUE obj)
|
|
1226
1244
|
*/
|
1227
1245
|
|
1228
1246
|
VALUE
|
1229
|
-
rb_file_s_umask( int argc, VALUE *argv)
|
1247
|
+
rb_file_s_umask( int argc, VALUE *argv, VALUE file)
|
1230
1248
|
{
|
1231
1249
|
int omask = 0;
|
1232
1250
|
|
@@ -1291,7 +1309,7 @@ rb_dir_s_current( VALUE dir)
|
|
1291
1309
|
*/
|
1292
1310
|
|
1293
1311
|
VALUE
|
1294
|
-
rb_dir_s_mkdir_bang( int argc, VALUE *argv)
|
1312
|
+
rb_dir_s_mkdir_bang( int argc, VALUE *argv, VALUE dir)
|
1295
1313
|
{
|
1296
1314
|
VALUE path, modes;
|
1297
1315
|
|
@@ -1301,7 +1319,7 @@ rb_dir_s_mkdir_bang( int argc, VALUE *argv)
|
|
1301
1319
|
|
1302
1320
|
parent[ 0] = rb_file_dirname( path);
|
1303
1321
|
parent[ 1] = modes;
|
1304
|
-
rb_dir_s_mkdir_bang( 2, parent);
|
1322
|
+
rb_dir_s_mkdir_bang( 2, parent, dir);
|
1305
1323
|
if (!id_mkdir)
|
1306
1324
|
id_mkdir = rb_intern( "mkdir");
|
1307
1325
|
if (NIL_P(modes))
|
@@ -1500,6 +1518,7 @@ void Init_supplement( void)
|
|
1500
1518
|
rb_define_method( rb_mKernel, "tap", rb_krn_tap, 0);
|
1501
1519
|
#endif
|
1502
1520
|
rb_define_method( rb_mKernel, "tap!", rb_krn_tap_bang, 0);
|
1521
|
+
rb_define_method( rb_mKernel, "with", rb_krn_with, 0);
|
1503
1522
|
|
1504
1523
|
rb_define_method( rb_cNilClass, "notempty?", rb_nil_notempty_p, 0);
|
1505
1524
|
rb_define_method( rb_cNilClass, "nonzero?", rb_nil_notempty_p, 0);
|
data/lib/supplement.h
CHANGED
@@ -17,6 +17,7 @@ extern VALUE rb_obj_new_string( VALUE);
|
|
17
17
|
extern VALUE rb_obj_nil_if( VALUE, VALUE);
|
18
18
|
extern VALUE rb_krn_tap( VALUE);
|
19
19
|
extern VALUE rb_krn_tap_bang( VALUE);
|
20
|
+
extern VALUE rb_krn_with( VALUE);
|
20
21
|
|
21
22
|
extern VALUE rb_nil_notempty_p( VALUE);
|
22
23
|
extern VALUE rb_nil_each_line( VALUE);
|
@@ -64,9 +65,9 @@ extern VALUE rb_num_cbrt( VALUE);
|
|
64
65
|
extern VALUE rb_hash_notempty_p( VALUE);
|
65
66
|
|
66
67
|
extern VALUE rb_file_size( VALUE);
|
67
|
-
extern VALUE rb_file_s_umask( int, VALUE
|
68
|
+
extern VALUE rb_file_s_umask( int, VALUE *, VALUE);
|
68
69
|
extern VALUE rb_dir_s_current( VALUE);
|
69
|
-
extern VALUE rb_dir_s_mkdir_bang( int, VALUE
|
70
|
+
extern VALUE rb_dir_s_mkdir_bang( int, VALUE *, VALUE);
|
70
71
|
extern VALUE rb_dir_children( VALUE);
|
71
72
|
|
72
73
|
extern VALUE rb_match_begin( int, VALUE *, VALUE);
|
data/lib/supplement/date.rb
CHANGED
@@ -64,6 +64,26 @@ class Date
|
|
64
64
|
self - (cwday-1)
|
65
65
|
end
|
66
66
|
|
67
|
+
def first_of_month
|
68
|
+
if day == 1 then
|
69
|
+
self
|
70
|
+
else
|
71
|
+
self.class.civil year, month, 1
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def months_forward n
|
76
|
+
res = self
|
77
|
+
n.times { res = res.next_month }
|
78
|
+
res
|
79
|
+
end
|
80
|
+
|
81
|
+
def months_backward n
|
82
|
+
res = self
|
83
|
+
n.times { res = res.prev_month }
|
84
|
+
res
|
85
|
+
end
|
86
|
+
|
67
87
|
end
|
68
88
|
|
69
89
|
|
data/lib/supplement/locked.c
CHANGED
@@ -42,7 +42,11 @@ rb_locked_init( int argc, VALUE *argv, VALUE self)
|
|
42
42
|
#endif
|
43
43
|
int op;
|
44
44
|
|
45
|
+
#ifdef FEATURE_SUPER_KWARGS
|
46
|
+
rb_call_super_kw(argc, argv, RB_PASS_CALLED_KEYWORDS);
|
47
|
+
#else
|
45
48
|
rb_call_super( argc, argv);
|
49
|
+
#endif
|
46
50
|
GetOpenFile( self, fptr);
|
47
51
|
|
48
52
|
op = fptr->mode & FMODE_WRITABLE ? LOCK_EX : LOCK_SH;
|
data/lib/supplement/terminal.c
CHANGED
@@ -99,15 +99,15 @@ io_reset( VALUE v)
|
|
99
99
|
|
100
100
|
/*
|
101
101
|
* call-seq:
|
102
|
-
* io.
|
102
|
+
* io.wingeom() -> ary
|
103
103
|
*
|
104
104
|
* Get the available window space.
|
105
105
|
*
|
106
|
-
* cols, rows, xpixel, ypixel = $stdout.
|
106
|
+
* cols, rows, xpixel, ypixel = $stdout.wingeom
|
107
107
|
*/
|
108
108
|
|
109
109
|
VALUE
|
110
|
-
|
110
|
+
rb_io_wingeom( VALUE self)
|
111
111
|
{
|
112
112
|
#ifndef RUBY_VM
|
113
113
|
OpenFile *fptr;
|
@@ -139,6 +139,6 @@ rb_io_winsize( VALUE self)
|
|
139
139
|
void Init_terminal( void)
|
140
140
|
{
|
141
141
|
rb_define_method( rb_cIO, "unget", rb_io_unget, -1);
|
142
|
-
rb_define_method( rb_cIO, "
|
142
|
+
rb_define_method( rb_cIO, "wingeom", rb_io_wingeom, 0);
|
143
143
|
}
|
144
144
|
|
data/lib/supplement/terminal.h
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: supplement
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.12'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bertram Scharpf
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: autorake
|
@@ -59,7 +59,7 @@ homepage: http://www.bertram-scharpf.de/software/supplement
|
|
59
59
|
licenses:
|
60
60
|
- BSD-2-Clause
|
61
61
|
metadata: {}
|
62
|
-
post_install_message:
|
62
|
+
post_install_message:
|
63
63
|
rdoc_options:
|
64
64
|
- "--charset"
|
65
65
|
- utf-8
|
@@ -79,8 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
version: '0'
|
80
80
|
requirements:
|
81
81
|
- Ruby and the autorake gem
|
82
|
-
rubygems_version: 3.0.
|
83
|
-
signing_key:
|
82
|
+
rubygems_version: 3.0.8
|
83
|
+
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Simple Ruby extensions
|
86
86
|
test_files: []
|