ruby-zen 0.0.2 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -9
- data/lib/ruby-zen/cli.rb +1 -0
- data/lib/ruby-zen/files/man.txt +360 -0
- data/lib/ruby-zen/files/title.txt +6 -0
- data/lib/ruby-zen/params.rb +3 -2
- data/lib/ruby-zen/rules.rb +33 -11
- data/lib/ruby-zen.rb +2 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc6fe2c149c2c67e100d65de2183b397be68894a74aba88249d41d269d003ee9
|
4
|
+
data.tar.gz: 8832190f3f38f76d50e336bf258a763ae6d0047df0e9c29f5cb80582d0e9b1e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3708fe53e877d9e1ae8495e91fbe1ecd0ea4d83b6b6a261e2c3a55cea0612b59f8d4ed8da8c09a31c50d577907d44ff603345b4392b81fe9138df5ad342b6bdd
|
7
|
+
data.tar.gz: 792bbdbcd2dd2e09df905b0610473faecf9d600e542ab2bd1ec64d8a57e23bf669b3d030fc63ce393a17831ad74f07d69afd3132b442de780d4cb20f8fb6a6e0
|
data/README.md
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
|
2
2
|
# RubyZen
|
3
3
|
|
4
|
-
Display Ruby ZEN rules.
|
5
|
-
|
4
|
+
Display Ruby ZEN rules in different languages.
|
5
|
+
(By now only Spanish is available but it will change soon. Sorry!)
|
6
6
|
|
7
|
-
|
7
|
+
![logo](./docs/images/logo.png)
|
8
8
|
|
9
|
-
|
10
|
-
1. Install Ruby on your system.
|
11
|
-
1. Install gem: `gem install ruby-zen`.
|
9
|
+
## Installation
|
12
10
|
|
13
|
-
|
11
|
+
1. Install Ruby on your system.
|
12
|
+
1. Install gem: `gem install ruby-zen`.
|
14
13
|
|
15
|
-
|
14
|
+
## Use
|
16
15
|
|
16
|
+
Run `rubyzen` command on your terminal
|
17
17
|
|
18
18
|
| Function | Description |
|
19
19
|
| -------- | ------------------------- |
|
@@ -21,6 +21,7 @@ Try with `rubyzen` command to see all functions.
|
|
21
21
|
| langs | Show available languages |
|
22
22
|
| show | Show Ruby ZEN rules |
|
23
23
|
|
24
|
-
|
24
|
+
## Contact
|
25
25
|
|
26
26
|
* **Email**: `dvarrui@protonmail.com`
|
27
|
+
* [IloveRuby - dvarrui](https://github.com/dvarrui/iloveruby)
|
data/lib/ruby-zen/cli.rb
CHANGED
@@ -0,0 +1,360 @@
|
|
1
|
+
|
2
|
+
NAME
|
3
|
+
ruby - Interpreted object-oriented scripting language
|
4
|
+
|
5
|
+
DESCRIPTION
|
6
|
+
Ruby is an interpreted scripting language for quick and easy object-oriented programming. It has many features
|
7
|
+
to process text files and to do system management tasks (like in Perl). It is simple, straight-forward, and
|
8
|
+
extensible.
|
9
|
+
|
10
|
+
If you want a language for easy object-oriented programming, or you don't like the Perl ugliness, or you do
|
11
|
+
like the concept of LISP, but don't like too many parentheses, Ruby might be your language of choice.
|
12
|
+
|
13
|
+
FEATURES
|
14
|
+
|
15
|
+
Interpretive
|
16
|
+
Ruby is an interpreted language, so you don't have to recompile programs written in Ruby to execute
|
17
|
+
them.
|
18
|
+
|
19
|
+
Variables have no type (dynamic typing)
|
20
|
+
Variables in Ruby can contain data of any type. You don't have to worry about variable typing. Conse-
|
21
|
+
quently, it has a weaker compile time check.
|
22
|
+
|
23
|
+
No declaration needed
|
24
|
+
You can use variables in your Ruby programs without any declarations. Variable names denote their scope
|
25
|
+
- global, class, instance, or local.
|
26
|
+
|
27
|
+
Simple syntax
|
28
|
+
Ruby has a simple syntax influenced slightly from Eiffel.
|
29
|
+
|
30
|
+
No user-level memory management
|
31
|
+
Ruby has automatic memory management. Objects no longer referenced from anywhere are automatically col-
|
32
|
+
lected by the garbage collector built into the interpreter.
|
33
|
+
|
34
|
+
Everything is an object
|
35
|
+
Ruby is a purely object-oriented language, and was so since its creation. Even such basic data as inte-
|
36
|
+
gers are seen as objects.
|
37
|
+
|
38
|
+
Class, inheritance, and methods
|
39
|
+
Being an object-oriented language, Ruby naturally has basic features like classes, inheritance, and
|
40
|
+
methods.
|
41
|
+
|
42
|
+
Singleton methods
|
43
|
+
Ruby has the ability to define methods for certain objects. For example, you can define a press-button
|
44
|
+
action for certain widget by defining a singleton method for the button. Or, you can make up your own
|
45
|
+
prototype based object system using singleton methods, if you want to.
|
46
|
+
|
47
|
+
Mix-in by modules
|
48
|
+
Ruby intentionally does not have the multiple inheritance as it is a source of confusion. Instead, Ruby
|
49
|
+
has the ability to share implementations across the inheritance tree. This is often called a `Mix-in'.
|
50
|
+
|
51
|
+
Iterators
|
52
|
+
Ruby has iterators for loop abstraction.
|
53
|
+
|
54
|
+
Closures
|
55
|
+
In Ruby, you can objectify the procedure.
|
56
|
+
|
57
|
+
Text processing and regular expressions
|
58
|
+
Ruby has a bunch of text processing features like in Perl.
|
59
|
+
|
60
|
+
M17N, character set independent
|
61
|
+
Ruby supports multilingualized programming. Easy to process texts written in many different natural lan-
|
62
|
+
guages and encoded in many different character encodings, without dependence on Unicode.
|
63
|
+
|
64
|
+
Bignums
|
65
|
+
With built-in bignums, you can for example calculate factorial(400).
|
66
|
+
|
67
|
+
Reflection and domain specific languages
|
68
|
+
Class is also an instance of the Class class. Definition of classes and methods is an expression just as
|
69
|
+
1+1 is. So your programs can even write and modify programs. Thus you can write your application in
|
70
|
+
your own programming language on top of Ruby.
|
71
|
+
|
72
|
+
Exception handling
|
73
|
+
As in Java(tm).
|
74
|
+
|
75
|
+
Direct access to the OS
|
76
|
+
Ruby can use most UNIX system calls, often used in system programming.
|
77
|
+
|
78
|
+
Dynamic loading
|
79
|
+
On most UNIX systems, you can load object files into the Ruby interpreter on-the-fly.
|
80
|
+
|
81
|
+
Rich libraries
|
82
|
+
In addition to the ``builtin libraries'' and ``standard libraries'' that are bundled with Ruby, a vast
|
83
|
+
amount of third-party libraries (``gems'') are available via the package management system called
|
84
|
+
`RubyGems', namely the gem(1) command. Visit RubyGems.org (https://rubygems.org/) to find the gems you
|
85
|
+
need, and explore GitHub (https://github.com/) to see how they are being developed and used.
|
86
|
+
|
87
|
+
|
88
|
+
-c Causes Ruby to check the syntax of the script and exit without executing. If there are no syntax errors,
|
89
|
+
Ruby will print ``Syntax OK'' to the standard output.
|
90
|
+
|
91
|
+
-d
|
92
|
+
|
93
|
+
--debug
|
94
|
+
Turns on debug mode. "$DEBUG" will be set to true.
|
95
|
+
|
96
|
+
-e command
|
97
|
+
Specifies script from command-line while telling Ruby not to search the rest of the arguments for a
|
98
|
+
script file name.
|
99
|
+
|
100
|
+
-h
|
101
|
+
|
102
|
+
--help Prints a summary of the options.
|
103
|
+
|
104
|
+
-i extension
|
105
|
+
Specifies in-place-edit mode. The extension, if specified, is added to old file name to make a backup
|
106
|
+
copy. For example:
|
107
|
+
|
108
|
+
% echo matz > /tmp/junk
|
109
|
+
% cat /tmp/junk
|
110
|
+
matz
|
111
|
+
% ruby -p -i.bak -e '$_.upcase!' /tmp/junk
|
112
|
+
% cat /tmp/junk
|
113
|
+
MATZ
|
114
|
+
% cat /tmp/junk.bak
|
115
|
+
matz
|
116
|
+
|
117
|
+
-l (The lowercase letter ``ell''.) Enables automatic line-ending processing, which means to firstly set
|
118
|
+
"$\" to the value of "$/", and secondly chops every line read using chop!.
|
119
|
+
|
120
|
+
-n Causes Ruby to assume the following loop around your script, which makes it iterate over file name argu-
|
121
|
+
ments somewhat like sed -n or awk.
|
122
|
+
|
123
|
+
while gets
|
124
|
+
...
|
125
|
+
end
|
126
|
+
|
127
|
+
-p Acts mostly same as -n switch, but print the value of variable "$_" at the each end of the loop. For
|
128
|
+
example:
|
129
|
+
|
130
|
+
% echo matz | ruby -p -e '$_.tr! "a-z", "A-Z"'
|
131
|
+
MATZ
|
132
|
+
|
133
|
+
-r library
|
134
|
+
Causes Ruby to load the library using require. It is useful when using -n or -p.
|
135
|
+
|
136
|
+
-s Enables some switch parsing for switches after script name but before any file name arguments (or before
|
137
|
+
a --). Any switches found there are removed from ARGV and set the corresponding variable in the script.
|
138
|
+
For example:
|
139
|
+
|
140
|
+
#! /usr/local/bin/ruby -s
|
141
|
+
# prints "true" if invoked with `-xyz' switch.
|
142
|
+
print "true\n" if $xyz
|
143
|
+
|
144
|
+
-v Enables verbose mode. Ruby will print its version at the beginning and set the variable "$VERBOSE" to
|
145
|
+
true. Some methods print extra messages if this variable is true. If this switch is given, and no
|
146
|
+
other switches are present, Ruby quits after printing its version.
|
147
|
+
|
148
|
+
-w Enables verbose mode without printing version message at the beginning. It sets the "$VERBOSE" variable
|
149
|
+
to true.
|
150
|
+
|
151
|
+
-x[directory]
|
152
|
+
Tells Ruby that the script is embedded in a message. Leading garbage will be discarded until the first
|
153
|
+
line that starts with ``#!'' and contains the string, ``ruby''. Any meaningful switches on that line
|
154
|
+
will be applied. The end of the script must be specified with either EOF, "^D" ("control-D"), "^Z"
|
155
|
+
("control-Z"), or the reserved word __END__. If the directory name is specified, Ruby will switch to
|
156
|
+
that directory before executing script.
|
157
|
+
|
158
|
+
-y
|
159
|
+
|
160
|
+
--yydebug
|
161
|
+
DO NOT USE.
|
162
|
+
|
163
|
+
Turns on compiler debug mode. Ruby will print a bunch of internal state messages during compilation.
|
164
|
+
Only specify this switch you are going to debug the Ruby interpreter.
|
165
|
+
|
166
|
+
--disable-FEATURE
|
167
|
+
|
168
|
+
--enable-FEATURE
|
169
|
+
Disables (or enables) the specified FEATURE.
|
170
|
+
|
171
|
+
--disable-gems
|
172
|
+
|
173
|
+
--enable-gems
|
174
|
+
Disables (or enables) RubyGems libraries. By default, Ruby will load the latest version of each
|
175
|
+
installed gem. The Gem constant is true if RubyGems is enabled, false if otherwise.
|
176
|
+
|
177
|
+
--disable-rubyopt
|
178
|
+
|
179
|
+
--enable-rubyopt
|
180
|
+
Ignores (or considers) the RUBYOPT environment variable. By default, Ruby considers the variable.
|
181
|
+
|
182
|
+
--disable-all
|
183
|
+
|
184
|
+
--enable-all
|
185
|
+
Disables (or enables) all features.
|
186
|
+
|
187
|
+
--dump=target
|
188
|
+
Dump some informations.
|
189
|
+
|
190
|
+
Prints the specified target. target can be one of;
|
191
|
+
|
192
|
+
version
|
193
|
+
version description same as --version
|
194
|
+
|
195
|
+
usage brief usage message same as -h
|
196
|
+
|
197
|
+
help Show long help message same as --help
|
198
|
+
|
199
|
+
syntax check of syntax same as -c --yydebug
|
200
|
+
|
201
|
+
yydebug
|
202
|
+
compiler debug mode, same as --yydebug
|
203
|
+
|
204
|
+
Only specify this switch if you are going to debug the Ruby interpreter.
|
205
|
+
|
206
|
+
parsetree
|
207
|
+
|
208
|
+
parsetree_with_comment
|
209
|
+
AST nodes tree
|
210
|
+
|
211
|
+
Only specify this switch if you are going to debug the Ruby interpreter.
|
212
|
+
|
213
|
+
insns disassembled instructions
|
214
|
+
|
215
|
+
Only specify this switch if you are going to debug the Ruby interpreter.
|
216
|
+
|
217
|
+
--verbose
|
218
|
+
Enables verbose mode without printing version message at the beginning. It sets the "$VERBOSE" variable
|
219
|
+
to true. If this switch is given, and no other switches are present, Ruby quits after printing its ver-
|
220
|
+
sion.
|
221
|
+
|
222
|
+
ENVIRONMENT
|
223
|
+
RUBYLIB
|
224
|
+
A colon-separated list of directories that are added to Ruby's library load path ("$:"). Directories
|
225
|
+
from this environment variable are searched before the standard load path is searched.
|
226
|
+
|
227
|
+
e.g.:
|
228
|
+
RUBYLIB="$HOME/lib/ruby:$HOME/lib/rubyext"
|
229
|
+
|
230
|
+
RUBYOPT
|
231
|
+
Additional Ruby options.
|
232
|
+
|
233
|
+
e.g.
|
234
|
+
RUBYOPT="-w -Ke"
|
235
|
+
|
236
|
+
Note that RUBYOPT can contain only -d,-E,-I,-K,-r,-T,-U,-v,-w,-W, --debug, --disable-FEATURE and
|
237
|
+
--enable-FEATURE.
|
238
|
+
|
239
|
+
RUBYPATH
|
240
|
+
A colon-separated list of directories that Ruby searches for Ruby programs when the -S flag is speci-
|
241
|
+
fied. This variable precedes the PATH environment variable.
|
242
|
+
|
243
|
+
RUBYSHELL
|
244
|
+
The path to the system shell command. This environment variable is enabled for only mswin32, mingw32,
|
245
|
+
and OS/2 platforms. If this variable is not defined, Ruby refers to COMSPEC.
|
246
|
+
|
247
|
+
PATH Ruby refers to the PATH environment variable on calling Kernel#system.
|
248
|
+
|
249
|
+
And Ruby depends on some RubyGems related environment variables unless RubyGems is disabled. See the
|
250
|
+
help of gem(1) as below.
|
251
|
+
|
252
|
+
% gem help
|
253
|
+
|
254
|
+
GC ENVIRONMENT
|
255
|
+
The Ruby garbage collector (GC) tracks objects in fixed-sized slots, but each object may have auxiliary memory
|
256
|
+
allocations handled by the malloc family of C standard library calls ( malloc(3), calloc(3), and realloc(3)) In
|
257
|
+
this documentatation, the "heap" refers to the Ruby object heap of fixed-sized slots, while "malloc" refers to
|
258
|
+
auxiliary allocations commonly referred to as the "process heap". Thus there are at least two possible ways to
|
259
|
+
trigger GC:
|
260
|
+
|
261
|
+
1 Reaching the object limit.
|
262
|
+
|
263
|
+
2 Reaching the malloc limit.
|
264
|
+
|
265
|
+
In Ruby 2.1, the generational GC was introduced and the limits are divided into young and old genera-
|
266
|
+
tions, providing two additional ways to trigger a GC:
|
267
|
+
|
268
|
+
3 Reaching the old object limit.
|
269
|
+
|
270
|
+
4 Reaching the old malloc limit.
|
271
|
+
|
272
|
+
There are currently 4 possible areas where the GC may be tuned by the following 11 environment vari-
|
273
|
+
ables:
|
274
|
+
|
275
|
+
RUBY_GC_HEAP_INIT_SLOTS
|
276
|
+
Initial allocation slots. Introduced in Ruby 2.1, default: 10000.
|
277
|
+
|
278
|
+
RUBY_GC_HEAP_FREE_SLOTS
|
279
|
+
Prepare at least this amount of slots after GC. Allocate this number slots if there are not enough
|
280
|
+
slots. Introduced in Ruby 2.1, default: 4096
|
281
|
+
|
282
|
+
RUBY_GC_HEAP_GROWTH_FACTOR
|
283
|
+
Increase allocation rate of heap slots by this factor. Introduced in Ruby 2.1, default: 1.8, minimum:
|
284
|
+
1.0 (no growth)
|
285
|
+
|
286
|
+
RUBY_GC_HEAP_GROWTH_MAX_SLOTS
|
287
|
+
Allocation rate is limited to this number of slots, preventing excessive allocation due to
|
288
|
+
RUBY_GC_HEAP_GROWTH_FACTOR. Introduced in Ruby 2.1, default: 0 (no limit)
|
289
|
+
|
290
|
+
RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR
|
291
|
+
Perform a full GC when the number of old objects is more than R * N, where R is this factor and N is the
|
292
|
+
number of old objects after the last full GC. Introduced in Ruby 2.1.1, default: 2.0
|
293
|
+
|
294
|
+
RUBY_GC_MALLOC_LIMIT
|
295
|
+
The initial limit of young generation allocation from the malloc-family. GC will start when this limit
|
296
|
+
is reached. Default: 16MB
|
297
|
+
|
298
|
+
RUBY_GC_MALLOC_LIMIT_MAX
|
299
|
+
The maximum limit of young generation allocation from malloc before GC starts. Prevents excessive mal-
|
300
|
+
loc growth due to RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR. Introduced in Ruby 2.1, default: 32MB.
|
301
|
+
|
302
|
+
RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR
|
303
|
+
Increases the limit of young generation malloc calls, reducing GC frequency but increasing malloc growth
|
304
|
+
until RUBY_GC_MALLOC_LIMIT_MAX is reached. Introduced in Ruby 2.1, default: 1.4, minimum: 1.0 (no
|
305
|
+
growth)
|
306
|
+
|
307
|
+
RUBY_GC_OLDMALLOC_LIMIT
|
308
|
+
The initial limit of old generation allocation from malloc, a full GC will start when this limit is
|
309
|
+
reached. Introduced in Ruby 2.1, default: 16MB
|
310
|
+
|
311
|
+
RUBY_GC_OLDMALLOC_LIMIT_MAX
|
312
|
+
The maximum limit of old generation allocation from malloc before a full GC starts. Prevents excessive
|
313
|
+
malloc growth due to RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR. Introduced in Ruby 2.1, default: 128MB
|
314
|
+
|
315
|
+
RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR
|
316
|
+
Increases the limit of old generation malloc allocation, reducing full GC frequency but increasing mal-
|
317
|
+
loc growth until RUBY_GC_OLDMALLOC_LIMIT_MAX is reached. Introduced in Ruby 2.1, default: 1.2, minimum:
|
318
|
+
1.0 (no growth)
|
319
|
+
|
320
|
+
STACK SIZE ENVIRONMENT
|
321
|
+
Stack size environment variables are implementation-dependent and subject to change with different versions of
|
322
|
+
Ruby. The VM stack is used for pure-Ruby code and managed by the virtual machine. Machine stack is used by
|
323
|
+
the operating system and its usage is dependent on C extensions as well as C compiler options. Using lower
|
324
|
+
values for these may allow applications to keep more Fibers or Threads running; but increases the chance of
|
325
|
+
SystemStackError exceptions and segmentation faults (SIGSEGV). These environment variables are available since
|
326
|
+
Ruby 2.0.0. All values are specified in bytes.
|
327
|
+
|
328
|
+
RUBY_THREAD_VM_STACK_SIZE
|
329
|
+
VM stack size used at thread creation. default: 131072 (32-bit CPU) or 262144 (64-bit)
|
330
|
+
|
331
|
+
RUBY_THREAD_MACHINE_STACK_SIZE
|
332
|
+
Machine stack size used at thread creation. default: 524288 or 1048575
|
333
|
+
|
334
|
+
RUBY_FIBER_VM_STACK_SIZE
|
335
|
+
VM stack size used at fiber creation. default: 65536 or 131072
|
336
|
+
|
337
|
+
RUBY_FIBER_MACHINE_STACK_SIZE
|
338
|
+
Machine stack size used at fiber creation. default: 262144 or 524288
|
339
|
+
|
340
|
+
SEE ALSO
|
341
|
+
https://www.ruby-lang.org/
|
342
|
+
The official web site.
|
343
|
+
|
344
|
+
https://www.ruby-toolbox.com/
|
345
|
+
Comprehensive catalog of Ruby libraries.
|
346
|
+
|
347
|
+
REPORTING BUGS
|
348
|
+
· Security vulnerabilities should be reported via an email to Mt security@ruby-lang.org. Reported prob-
|
349
|
+
lems will be published after being fixed.
|
350
|
+
|
351
|
+
· Other bugs and feature requests can be reported via the Ruby Issue Tracking System (https://bugs.ruby-
|
352
|
+
lang.org/). Do not report security vulnerabilities via this system because it publishes the vulnerabil-
|
353
|
+
ities immediately.
|
354
|
+
|
355
|
+
AUTHORS
|
356
|
+
Ruby is designed and implemented by Yukihiro Matsumoto <matz@netlab.jp>.
|
357
|
+
|
358
|
+
See <https://bugs.ruby-lang.org/projects/ruby/wiki/Contributors> for contributors to Ruby.
|
359
|
+
|
360
|
+
October 31, 2015 Ruby Programmer's Reference Guide RUBY(1)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
____ _ __________ _ _ _
|
2
|
+
| _ \ _ _| |__ _ _ |__ / ____| \ | | _ __ _ _| | ___ ___
|
3
|
+
| |_) | | | | '_ \| | | | / /| _| | \| | | '__| | | | |/ _ \/ __|
|
4
|
+
| _ <| |_| | |_) | |_| | / /_| |___| |\ | | | | |_| | | __/\__ \
|
5
|
+
|_| \_\\__,_|_.__/ \__, | /____|_____|_| \_| |_| \__,_|_|\___||___/
|
6
|
+
|___/
|
data/lib/ruby-zen/params.rb
CHANGED
data/lib/ruby-zen/rules.rb
CHANGED
@@ -7,25 +7,31 @@ class Rules
|
|
7
7
|
@app = application
|
8
8
|
end
|
9
9
|
|
10
|
-
def show(options =
|
11
|
-
if options
|
12
|
-
|
10
|
+
def show(options = { 'more' => false, 'step' => true })
|
11
|
+
if options['more']
|
12
|
+
step = options['step']
|
13
|
+
show_more(step: step)
|
13
14
|
else
|
14
|
-
|
15
|
+
show_only_names
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
private
|
20
|
+
|
21
|
+
def show_title
|
22
|
+
dirbase = File.dirname(__FILE__)
|
23
|
+
filepath = File.join(dirbase, 'files', 'title.txt')
|
24
|
+
content = File.read(filepath)
|
25
|
+
puts content
|
26
|
+
puts
|
23
27
|
end
|
24
28
|
|
25
|
-
def
|
29
|
+
def show_more(step:)
|
30
|
+
show_title
|
31
|
+
|
26
32
|
@app.rules.each_with_index do |rule, index|
|
27
33
|
principle = rule[:rule]
|
28
|
-
puts "
|
34
|
+
puts "[#{(index + 1)}] #{principle}"
|
29
35
|
desc = rule[:desc]
|
30
36
|
if desc.is_a? String
|
31
37
|
puts "#{desc}\n".white
|
@@ -36,6 +42,22 @@ class Rules
|
|
36
42
|
puts text
|
37
43
|
end
|
38
44
|
end
|
45
|
+
puts
|
46
|
+
if step
|
47
|
+
print '[Press ENTER to continue]'
|
48
|
+
STDIN.gets
|
49
|
+
puts
|
50
|
+
end
|
39
51
|
end
|
40
52
|
end
|
53
|
+
|
54
|
+
def show_only_names
|
55
|
+
show_title
|
56
|
+
|
57
|
+
@app.rules.each_with_index do |rule, index|
|
58
|
+
principle = rule[:rule]
|
59
|
+
puts "[#{(index + 1)}] #{principle}"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
41
63
|
end
|
data/lib/ruby-zen.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-zen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Vargas Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -67,10 +67,12 @@ files:
|
|
67
67
|
- lib/ruby-zen.rb
|
68
68
|
- lib/ruby-zen/application.rb
|
69
69
|
- lib/ruby-zen/cli.rb
|
70
|
+
- lib/ruby-zen/files/man.txt
|
71
|
+
- lib/ruby-zen/files/title.txt
|
70
72
|
- lib/ruby-zen/files/zenfile.yaml
|
71
73
|
- lib/ruby-zen/params.rb
|
72
74
|
- lib/ruby-zen/rules.rb
|
73
|
-
homepage: https://github.com/dvarrui/
|
75
|
+
homepage: https://github.com/dvarrui/tools/tree/main/ruby.zen.d
|
74
76
|
licenses:
|
75
77
|
- GPL-3.0
|
76
78
|
metadata: {}
|