enhanced_errors 0.1.0 → 0.1.1
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/.yardoc/checksums +4 -0
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/README.md +33 -19
- data/doc/Binding.html +137 -0
- data/doc/Colors.html +384 -0
- data/doc/Debugging.html +181 -0
- data/doc/EnhancedErrors.html +2742 -0
- data/doc/ErrorEnhancements.html +252 -0
- data/doc/_index.html +151 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +503 -0
- data/doc/file.README.html +432 -0
- data/doc/file_list.html +59 -0
- data/doc/frames.html +22 -0
- data/doc/images/enhanced-error.png +0 -0
- data/doc/index.html +432 -0
- data/doc/js/app.js +344 -0
- data/doc/js/full_list.js +242 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +286 -0
- data/doc/top-level-namespace.html +112 -0
- data/enhanced_errors.gemspec +4 -2
- data/lib/enhanced_errors.rb +43 -30
- metadata +56 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c52d576256ec4fc2c77dde8744813310bb49c1108e123725b610d6fc9a09902a
|
4
|
+
data.tar.gz: 7917a2419c729feb708b100a19ee7c3a8b9defec42d34f991331e054cd1800f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 225ec06e204a1783a479e1eed7d648a0c564e4fe93408d96e7d9e7f20153cb6ec481eb254e7d230c888a8d512b69333ff245244fe638d4257a7899de62896410
|
7
|
+
data.tar.gz: aacbe2caa5ddbf1b73cc3544136ddec8f97975f5ad2a977a14163200874d02db8aa75d421878206d275f78d859876bb6c96770aba97668842f2aa3c1c198f63a
|
data/.yardoc/checksums
ADDED
data/.yardoc/complete
ADDED
File without changes
|
Binary file
|
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/README.md
CHANGED
@@ -7,10 +7,13 @@
|
|
7
7
|
**EnhancedErrors** leverages Ruby's built-in [TracePoint](https://ruby-doc.org/core-3.1.0/TracePoint.html) feature to provide detailed context for exceptions, making debugging easier without significant performance overhead.
|
8
8
|
|
9
9
|
When an exception is raised, EnhancedErrors captures the surrounding context. It works like this:
|
10
|
+
<br>
|
11
|
+
|
12
|
+
#### Enhanced Exception In Code:
|
10
13
|
|
11
14
|
```ruby
|
12
15
|
|
13
|
-
require '
|
16
|
+
require 'enhanced_errors'
|
14
17
|
require 'awesome_print' # Optional, for better output
|
15
18
|
|
16
19
|
EnhancedErrors.enhance!
|
@@ -29,10 +32,13 @@ foo
|
|
29
32
|
|
30
33
|
```
|
31
34
|
|
32
|
-
|
35
|
+
##### Output:
|
33
36
|
|
34
37
|
<img src="./doc/images/enhanced-error.png" style="height: 171px; width: 440px;"></img>
|
35
38
|
|
39
|
+
<br>
|
40
|
+
|
41
|
+
#### Enhanced Exception In Specs:
|
36
42
|
|
37
43
|
```ruby
|
38
44
|
describe 'attains enlightenment' do
|
@@ -51,7 +57,7 @@ foo
|
|
51
57
|
end
|
52
58
|
```
|
53
59
|
|
54
|
-
####
|
60
|
+
#### Output:
|
55
61
|
|
56
62
|
<img src="./doc/images/enhanced-spec.png" style="height: 426px; width: 712px;"></img>
|
57
63
|
|
@@ -71,26 +77,24 @@ foo
|
|
71
77
|
|
72
78
|
EnhancedErrors has a few big use-cases:
|
73
79
|
|
74
|
-
* Data-driven bugs
|
80
|
+
* **Catch Data-driven bugs**. For example, if, while processing a 10 gig file, you get an error, you can't just re-run the code with a debugger.
|
75
81
|
You also can't just print out all the data, because it's too big. You want to know what the data was the cause of the error.
|
76
|
-
Ideally, without long instrument-re-run-fix loops.
|
82
|
+
Ideally, without long instrument-re-run-fix loops. If your logging didn't capture the data, normally, you'd be stuck.
|
77
83
|
|
78
|
-
|
84
|
+
* **Debug** a complex application erroring deep in the stack when you can't tell where the error originates
|
79
85
|
|
80
|
-
*
|
86
|
+
* **Faster TDD** - Often, you won't have to re-run to see an error--you can go straight to the fix.
|
81
87
|
|
82
|
-
* Faster
|
83
|
-
|
84
|
-
* Faster CI -> Dev fixes. When a bug happens in CI, usually there's a step where you first reproduce it locally.
|
88
|
+
* **Faster CI -> Fix loop**. When a bug happens in CI, usually there's a step where you first reproduce it locally.
|
85
89
|
EnhancedErrors can help you skip that step.
|
86
90
|
|
87
|
-
* Faster debugging
|
91
|
+
* **Faster debugging**. In general, you can skip the add-instrumentation step and jump to the fix.
|
88
92
|
|
89
|
-
* Heisenbugs - bugs that disappear when you try to debug them. EnhancedErrors can help you capture the data that causes the bug before it disappears.
|
93
|
+
* **Heisenbugs** - bugs that disappear when you try to debug them. EnhancedErrors can help you capture the data that causes the bug before it disappears.
|
90
94
|
|
91
|
-
*
|
95
|
+
* **Unknown Unknowns** - you can't pre-emptively log variables from failure cases you never imagined.
|
92
96
|
|
93
|
-
* Cron jobs and daemons - when it fails for unknown reasons at 4am, check the log and fix--it probably has what you need.
|
97
|
+
* **Cron jobs** and **daemons** - when it fails for unknown reasons at 4am, check the log and fix--it probably has what you need.
|
94
98
|
|
95
99
|
## Installation
|
96
100
|
|
@@ -117,11 +121,19 @@ $ gem install enhanced_errors
|
|
117
121
|
To enable EnhancedErrors, call the `enhance!` method:
|
118
122
|
|
119
123
|
```ruby
|
124
|
+
# For a rails app, put this in an initializer, or spec_helper.rb
|
125
|
+
# ex: config/initializers/enhanced_errors.rb
|
126
|
+
|
127
|
+
require 'awesome_print' # Optional, for better output
|
120
128
|
EnhancedErrors.enhance!
|
129
|
+
|
130
|
+
# -> now your error messages will have variables and their values appended to them.
|
131
|
+
|
121
132
|
```
|
122
133
|
|
123
134
|
This activates the TracePoint to start capturing exceptions and their surrounding context.
|
124
135
|
|
136
|
+
|
125
137
|
### Configuration Options
|
126
138
|
|
127
139
|
You can pass configuration options to `enhance!`:
|
@@ -133,6 +145,7 @@ EnhancedErrors.enhance!(enabled: true, max_length: 2000) do
|
|
133
145
|
end
|
134
146
|
|
135
147
|
```
|
148
|
+
- `add_to_skip_list`: Variables to ignore, as symbols. ex: :@instance_variable_to_skip, :local_to_skip`
|
136
149
|
- `enabled`: Enables or disables the enhancement (default: `true`).
|
137
150
|
- `max_length`: Sets the maximum length of the enhanced message (default: `2500`).
|
138
151
|
|
@@ -319,7 +332,7 @@ encryptor = ENCRYPTOR
|
|
319
332
|
EnhancedErrors.on_format = lambda do |formatted_string|
|
320
333
|
encrypted_data = encryptor.encrypt_and_sign(formatted_string)
|
321
334
|
encrypted_base64 = Base64.strict_encode64(encrypted_data)
|
322
|
-
"ENCRYPTED[#{
|
335
|
+
"ENCRYPTED[#{encrypted_base64}]"
|
323
336
|
end
|
324
337
|
```
|
325
338
|
|
@@ -342,10 +355,11 @@ The captured data is then appended to the exception's message, providing rich co
|
|
342
355
|
|
343
356
|
## Awesome Print
|
344
357
|
|
345
|
-
EnhancedErrors uses the [awesome_print](https://github.com/awesome-print/awesome_print)
|
346
|
-
gem to format the captured data,
|
347
|
-
If not,
|
348
|
-
required directly by EnhancedErrors, so you will need to add it to your Gemfile
|
358
|
+
EnhancedErrors automatically uses the [awesome_print](https://github.com/awesome-print/awesome_print)
|
359
|
+
gem to format the captured data, ___if___ it is installed and available.
|
360
|
+
If not, error enhancement will work, but the output may be less pretty (er, awesome).
|
361
|
+
AwesomePrint is not required directly by EnhancedErrors, so you will need to add it to your Gemfile
|
362
|
+
if you want to use it.
|
349
363
|
|
350
364
|
```ruby
|
351
365
|
gem 'awesome_print'
|
data/doc/Binding.html
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: Binding
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.37
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "Binding";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index (B)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Binding</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: Binding
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">Binding</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<dl>
|
91
|
+
<dt>Includes:</dt>
|
92
|
+
<dd><span class='object_link'><a href="Debugging.html" title="Debugging (module)">Debugging</a></span></dd>
|
93
|
+
</dl>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dl>
|
101
|
+
<dt>Defined in:</dt>
|
102
|
+
<dd>lib/binding.rb</dd>
|
103
|
+
</dl>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<h2>Method Summary</h2>
|
122
|
+
|
123
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Debugging.html" title="Debugging (module)">Debugging</a></span></h3>
|
124
|
+
<p class="inherited"><span class='object_link'><a href="Debugging.html#let_vars_hash-instance_method" title="Debugging#let_vars_hash (method)">#let_vars_hash</a></span></p>
|
125
|
+
|
126
|
+
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<div id="footer">
|
130
|
+
Generated on Tue Oct 22 23:16:25 2024 by
|
131
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
132
|
+
0.9.37 (ruby-3.1.3).
|
133
|
+
</div>
|
134
|
+
|
135
|
+
</div>
|
136
|
+
</body>
|
137
|
+
</html>
|
data/doc/Colors.html
ADDED
@@ -0,0 +1,384 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: Colors
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.37
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "Colors";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index (C)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Colors</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: Colors
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">Colors</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/colors.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
<h2>
|
105
|
+
Constant Summary
|
106
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
107
|
+
</h2>
|
108
|
+
|
109
|
+
<dl class="constants">
|
110
|
+
|
111
|
+
<dt id="COLORS-constant" class="">COLORS =
|
112
|
+
|
113
|
+
</dt>
|
114
|
+
<dd><pre class="code"><span class='lbrace'>{</span> <span class='label'>red:</span> <span class='int'>31</span><span class='comma'>,</span> <span class='label'>green:</span> <span class='int'>32</span><span class='comma'>,</span> <span class='label'>yellow:</span> <span class='int'>33</span><span class='comma'>,</span> <span class='label'>blue:</span> <span class='int'>34</span><span class='comma'>,</span> <span class='label'>purple:</span> <span class='int'>35</span><span class='comma'>,</span> <span class='label'>cyan:</span> <span class='int'>36</span><span class='comma'>,</span> <span class='label'>white:</span> <span class='int'>0</span> <span class='rbrace'>}</span></pre></dd>
|
115
|
+
|
116
|
+
</dl>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
<h2>
|
127
|
+
Class Method Summary
|
128
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
129
|
+
</h2>
|
130
|
+
|
131
|
+
<ul class="summary">
|
132
|
+
|
133
|
+
<li class="public ">
|
134
|
+
<span class="summary_signature">
|
135
|
+
|
136
|
+
<a href="#code-class_method" title="code (class method)">.<strong>code</strong>(num) ⇒ Object </a>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
</span>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
151
|
+
|
152
|
+
</li>
|
153
|
+
|
154
|
+
|
155
|
+
<li class="public ">
|
156
|
+
<span class="summary_signature">
|
157
|
+
|
158
|
+
<a href="#color-class_method" title="color (class method)">.<strong>color</strong>(num, string) ⇒ Object </a>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
</span>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
173
|
+
|
174
|
+
</li>
|
175
|
+
|
176
|
+
|
177
|
+
<li class="public ">
|
178
|
+
<span class="summary_signature">
|
179
|
+
|
180
|
+
<a href="#enabled=-class_method" title="enabled= (class method)">.<strong>enabled=</strong>(value) ⇒ Object </a>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
</span>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
195
|
+
|
196
|
+
</li>
|
197
|
+
|
198
|
+
|
199
|
+
<li class="public ">
|
200
|
+
<span class="summary_signature">
|
201
|
+
|
202
|
+
<a href="#enabled%3F-class_method" title="enabled? (class method)">.<strong>enabled?</strong> ⇒ Boolean </a>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
</span>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
|
220
|
+
|
221
|
+
</ul>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
<div id="class_method_details" class="method_details_list">
|
227
|
+
<h2>Class Method Details</h2>
|
228
|
+
|
229
|
+
|
230
|
+
<div class="method_details first">
|
231
|
+
<h3 class="signature first" id="code-class_method">
|
232
|
+
|
233
|
+
.<strong>code</strong>(num) ⇒ <tt>Object</tt>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
</h3><table class="source_code">
|
240
|
+
<tr>
|
241
|
+
<td>
|
242
|
+
<pre class="lines">
|
243
|
+
|
244
|
+
|
245
|
+
17
|
246
|
+
18
|
247
|
+
19</pre>
|
248
|
+
</td>
|
249
|
+
<td>
|
250
|
+
<pre class="code"><span class="info file"># File 'lib/colors.rb', line 17</span>
|
251
|
+
|
252
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_code'>code</span><span class='lparen'>(</span><span class='id identifier rubyid_num'>num</span><span class='rparen'>)</span>
|
253
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\e[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_num'>num</span><span class='embexpr_end'>}</span><span class='tstring_content'>m</span><span class='tstring_end'>"</span></span>
|
254
|
+
<span class='kw'>end</span></pre>
|
255
|
+
</td>
|
256
|
+
</tr>
|
257
|
+
</table>
|
258
|
+
</div>
|
259
|
+
|
260
|
+
<div class="method_details ">
|
261
|
+
<h3 class="signature " id="color-class_method">
|
262
|
+
|
263
|
+
.<strong>color</strong>(num, string) ⇒ <tt>Object</tt>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
</h3><table class="source_code">
|
270
|
+
<tr>
|
271
|
+
<td>
|
272
|
+
<pre class="lines">
|
273
|
+
|
274
|
+
|
275
|
+
13
|
276
|
+
14
|
277
|
+
15</pre>
|
278
|
+
</td>
|
279
|
+
<td>
|
280
|
+
<pre class="code"><span class="info file"># File 'lib/colors.rb', line 13</span>
|
281
|
+
|
282
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='id identifier rubyid_num'>num</span><span class='comma'>,</span> <span class='id identifier rubyid_string'>string</span><span class='rparen'>)</span>
|
283
|
+
<span class='ivar'>@enabled</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_code'>code</span><span class='lparen'>(</span><span class='id identifier rubyid_num'>num</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_string'>string</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_code'>code</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='op'>:</span> <span class='id identifier rubyid_string'>string</span>
|
284
|
+
<span class='kw'>end</span></pre>
|
285
|
+
</td>
|
286
|
+
</tr>
|
287
|
+
</table>
|
288
|
+
</div>
|
289
|
+
|
290
|
+
<div class="method_details ">
|
291
|
+
<h3 class="signature " id="enabled=-class_method">
|
292
|
+
|
293
|
+
.<strong>enabled=</strong>(value) ⇒ <tt>Object</tt>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
</h3><table class="source_code">
|
300
|
+
<tr>
|
301
|
+
<td>
|
302
|
+
<pre class="lines">
|
303
|
+
|
304
|
+
|
305
|
+
9
|
306
|
+
10
|
307
|
+
11</pre>
|
308
|
+
</td>
|
309
|
+
<td>
|
310
|
+
<pre class="code"><span class="info file"># File 'lib/colors.rb', line 9</span>
|
311
|
+
|
312
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_enabled='>enabled=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
313
|
+
<span class='ivar'>@enabled</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
314
|
+
<span class='kw'>end</span></pre>
|
315
|
+
</td>
|
316
|
+
</tr>
|
317
|
+
</table>
|
318
|
+
</div>
|
319
|
+
|
320
|
+
<div class="method_details ">
|
321
|
+
<h3 class="signature " id="enabled?-class_method">
|
322
|
+
|
323
|
+
.<strong>enabled?</strong> ⇒ <tt>Boolean</tt>
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
</h3><div class="docstring">
|
330
|
+
<div class="discussion">
|
331
|
+
|
332
|
+
|
333
|
+
</div>
|
334
|
+
</div>
|
335
|
+
<div class="tags">
|
336
|
+
|
337
|
+
<p class="tag_title">Returns:</p>
|
338
|
+
<ul class="return">
|
339
|
+
|
340
|
+
<li>
|
341
|
+
|
342
|
+
|
343
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
</li>
|
348
|
+
|
349
|
+
</ul>
|
350
|
+
|
351
|
+
</div><table class="source_code">
|
352
|
+
<tr>
|
353
|
+
<td>
|
354
|
+
<pre class="lines">
|
355
|
+
|
356
|
+
|
357
|
+
5
|
358
|
+
6
|
359
|
+
7</pre>
|
360
|
+
</td>
|
361
|
+
<td>
|
362
|
+
<pre class="code"><span class="info file"># File 'lib/colors.rb', line 5</span>
|
363
|
+
|
364
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_enabled?'>enabled?</span>
|
365
|
+
<span class='ivar'>@enabled</span>
|
366
|
+
<span class='kw'>end</span></pre>
|
367
|
+
</td>
|
368
|
+
</tr>
|
369
|
+
</table>
|
370
|
+
</div>
|
371
|
+
|
372
|
+
</div>
|
373
|
+
|
374
|
+
</div>
|
375
|
+
|
376
|
+
<div id="footer">
|
377
|
+
Generated on Tue Oct 22 23:16:25 2024 by
|
378
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
379
|
+
0.9.37 (ruby-3.1.3).
|
380
|
+
</div>
|
381
|
+
|
382
|
+
</div>
|
383
|
+
</body>
|
384
|
+
</html>
|