ykutils 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ykutils/debugutils.rb +44 -32
- data/lib/ykutils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e431ef900874b8c99755026b48f24551b8bb1c3348f1b8583d959ea064787bcb
|
4
|
+
data.tar.gz: 7ceb60faec4c79c04ea301d2fcc6ea9350fc2f821543b6897788bee74bba09f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b25b6ccc71d2c0b8cab672a032e0089515f86849a6015a4a6f8ca601f0dd6190633b16bc6ade99e294b575fe76eccd492368bee65d47d7db886532a35b08669
|
7
|
+
data.tar.gz: 9cf7993551510eac9de00fa8d01a78574c278f628421fd59fb8abf57e4f41e4116a010cfb520ddee3a4ea46e6bc5023dbc8b9798504614c1a9894673d75b9f04
|
data/Gemfile.lock
CHANGED
data/lib/ykutils/debugutils.rb
CHANGED
@@ -3,43 +3,55 @@ require "pp"
|
|
3
3
|
module Ykutils
|
4
4
|
module DebugUtils
|
5
5
|
class DebugMes
|
6
|
+
@debug = false
|
7
|
+
@warn = false
|
8
|
+
@buf = []
|
9
|
+
|
6
10
|
def self.init(debug = false)
|
7
|
-
|
8
|
-
|
11
|
+
@debug = debug
|
12
|
+
@buf = []
|
9
13
|
end
|
10
14
|
|
11
15
|
def self.set_debug(debug)
|
12
|
-
|
16
|
+
@debug = debug
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.get_debug
|
20
|
+
@debug
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.set_warn(warn)
|
24
|
+
@warn = warn
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.get_warn
|
28
|
+
@warn
|
13
29
|
end
|
14
30
|
|
15
31
|
def self.puts_x(mes)
|
16
|
-
|
17
|
-
@@buf << mes
|
18
|
-
# puts "#{@@buf.size} |#{mes}"
|
32
|
+
@buf << mes
|
19
33
|
end
|
20
34
|
|
21
35
|
def self.get
|
22
|
-
|
23
|
-
# DebugMes.clear
|
36
|
+
@buf
|
24
37
|
end
|
25
38
|
|
26
39
|
def self.clear
|
27
|
-
|
28
|
-
@@buf.clear
|
40
|
+
@buf.clear
|
29
41
|
end
|
30
42
|
end
|
31
43
|
|
32
44
|
def clear_d
|
33
|
-
DebugMes
|
45
|
+
Ykutils::DebugUtils::DebugMes..clear
|
34
46
|
end
|
35
47
|
|
36
48
|
def puts_d(mes)
|
37
|
-
DebugMes
|
49
|
+
Ykutils::DebugUtils::DebugMes..puts_x(mes)
|
38
50
|
# puts mes
|
39
51
|
end
|
40
52
|
|
41
53
|
def get_d
|
42
|
-
|
54
|
+
self.class.get
|
43
55
|
end
|
44
56
|
|
45
57
|
def puts_current_method
|
@@ -56,46 +68,46 @@ module Ykutils
|
|
56
68
|
set_debug(false)
|
57
69
|
set_warn(0)
|
58
70
|
|
59
|
-
DebugMes.init(false)
|
71
|
+
Ykutils::DebugUtils::DebugMes.init(false)
|
60
72
|
end
|
61
73
|
|
62
74
|
def set_debug(val)
|
63
|
-
|
64
|
-
DebugMes.set_debug(val)
|
75
|
+
# self.class.set_debug(val)
|
76
|
+
Ykutils::DebugUtils::DebugMes.set_debug(val)
|
65
77
|
end
|
66
78
|
|
67
79
|
def get_debug
|
68
|
-
|
80
|
+
Ykutils::DebugUtils::DebugMes.get_debug
|
69
81
|
end
|
70
82
|
|
71
83
|
def set_warn(val)
|
72
|
-
|
84
|
+
Ykutils::DebugUtils::DebugMes.set_warn(val)
|
73
85
|
end
|
74
86
|
|
75
|
-
def
|
76
|
-
|
87
|
+
def get_warn
|
88
|
+
Ykutils::DebugUtils::DebugMes..get_warn
|
77
89
|
end
|
78
90
|
|
79
91
|
def d_exit(num)
|
80
|
-
exit(num) if
|
92
|
+
exit(num) if get_debug
|
81
93
|
end
|
82
94
|
|
83
95
|
def d_puts(str)
|
84
|
-
puts(str) if
|
96
|
+
puts(str) if get_debug
|
85
97
|
end
|
86
98
|
|
87
99
|
def w1_puts(str)
|
88
|
-
set_warn(0) unless
|
89
|
-
puts(str) if
|
100
|
+
set_warn(0) unless get_warn
|
101
|
+
puts(str) if get_debug or get_warn >= 1
|
90
102
|
end
|
91
103
|
|
92
104
|
def w2_puts(str)
|
93
|
-
set_warn(0) unless
|
94
|
-
puts(str) if
|
105
|
+
set_warn(0) unless get_warn
|
106
|
+
puts(str) if get_debug or get_warn >= 2
|
95
107
|
end
|
96
108
|
|
97
109
|
def d_caller(_num)
|
98
|
-
pp caller(0) if
|
110
|
+
pp caller(0) if get_debug
|
99
111
|
end
|
100
112
|
|
101
113
|
def puts_no_empty(mes)
|
@@ -103,20 +115,20 @@ module Ykutils
|
|
103
115
|
end
|
104
116
|
|
105
117
|
def d_puts_no_empty(mes)
|
106
|
-
puts mes if mes != "" and
|
118
|
+
puts mes if mes != "" and get_debug
|
107
119
|
end
|
108
120
|
|
109
121
|
def d_p(it)
|
110
|
-
p it if
|
122
|
+
p it if get_debug
|
111
123
|
end
|
112
124
|
|
113
125
|
def d_pp(it)
|
114
|
-
if
|
115
|
-
pp "
|
126
|
+
if get_debug
|
127
|
+
pp "debug=#{get_debug}"
|
116
128
|
pp caller(0)
|
117
129
|
exit
|
118
130
|
end
|
119
|
-
pp it if
|
131
|
+
pp it if get_debug
|
120
132
|
end
|
121
133
|
end
|
122
134
|
end
|
data/lib/ykutils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ykutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yasuo kominami
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erubi
|