ruby-zen 0.0.3 → 0.0.6
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 -8
- data/lib/ruby-zen/application.rb +0 -2
- data/lib/ruby-zen/cli.rb +2 -3
- data/lib/ruby-zen/files/man.txt +360 -0
- data/lib/ruby-zen/files/zenfile.yaml +24 -7
- data/lib/ruby-zen/params.rb +2 -1
- data/lib/ruby-zen/rules.rb +8 -5
- data/lib/ruby-zen.rb +2 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d44ba9994cd4ecf369c78076589571a847a39f1ce30ea1c1c513beca3772d518
|
4
|
+
data.tar.gz: 661f144c3c950673420be799577979bddf13d30c34ea54a36fe5a876b5de143a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eda1558e53bf8228bfecc56b93eb54b1e7064f73af5f9eb34f66ca132e7939f7f9f72dfd8b0389634a1d4cfa910ef94f4b64c04fdad2730ff97519c162ca7541
|
7
|
+
data.tar.gz: dcc8fa003ee57d47e32bd278815250e70655abe9cdbed61a9dcb37b8530fc5304dd39d3b189b935dcd0af6e2f40d965f59aa653c7c186e2181e65e8de18a1d2f
|
data/README.md
CHANGED
@@ -1,27 +1,29 @@
|
|
1
1
|
|
2
2
|
# RubyZen
|
3
3
|
|
4
|
-
Display Ruby ZEN rules.
|
4
|
+
Display Ruby ZEN rules in different languages.
|
5
|
+
(By now only Spanish is available but it will change soon. Sorry!)
|
5
6
|
|
6
7
|
![logo](./docs/images/logo.png)
|
7
8
|
|
8
|
-
|
9
|
+
## Installation
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
1. Install gem: `gem install ruby-zen`.
|
11
|
+
1. Install Ruby on your system.
|
12
|
+
1. Install gem: `gem install ruby-zen`.
|
13
13
|
|
14
|
-
|
14
|
+
## Use
|
15
15
|
|
16
|
-
Run `rubyzen` command
|
16
|
+
Run `rubyzen` command on your terminal
|
17
17
|
|
18
18
|
| Function | Description |
|
19
19
|
| -------- | ------------------------- |
|
20
20
|
| version | Show currente version |
|
21
21
|
| langs | Show available languages |
|
22
22
|
| show | Show Ruby ZEN rules |
|
23
|
+
| show --more | Show every rule with detailed explanation |
|
24
|
+
| show --more --step | Show every rule with detailed explanation, step by step |
|
23
25
|
|
24
|
-
|
26
|
+
## Contact
|
25
27
|
|
26
28
|
* **Email**: `dvarrui@protonmail.com`
|
27
29
|
* [IloveRuby - dvarrui](https://github.com/dvarrui/iloveruby)
|
data/lib/ruby-zen/application.rb
CHANGED
@@ -6,7 +6,6 @@ class Application
|
|
6
6
|
include Params
|
7
7
|
|
8
8
|
attr_reader :lang
|
9
|
-
attr_reader :config_filepath
|
10
9
|
attr_reader :data
|
11
10
|
|
12
11
|
def initialize(language = :es)
|
@@ -23,7 +22,6 @@ class Application
|
|
23
22
|
def load_data
|
24
23
|
basedir = File.dirname(__FILE__)
|
25
24
|
filepath = File.join(basedir, 'files', ZEN_FILENAME)
|
26
|
-
@config_filepath = filepath
|
27
25
|
YAML.load(File.read(filepath))
|
28
26
|
end
|
29
27
|
end
|
data/lib/ruby-zen/cli.rb
CHANGED
@@ -24,15 +24,14 @@ class CLI < Thor
|
|
24
24
|
end
|
25
25
|
|
26
26
|
map ['-s', '--show'] => 'show'
|
27
|
-
option :more, type: :boolean
|
28
27
|
option :step, type: :boolean
|
28
|
+
option :full, type: :boolean
|
29
29
|
option :lang, type: :string
|
30
|
-
desc 'show [LANG]', 'Display ZEN rules in the chosen language'
|
30
|
+
desc 'show [--step, --full, --lang=[LANG]]', 'Display ZEN rules in the chosen language'
|
31
31
|
long_desc <<-LONGDESC
|
32
32
|
Display the rules in the chosen language
|
33
33
|
LONGDESC
|
34
34
|
def show
|
35
|
-
# Typical error... write show(options) instead of show! jajaja
|
36
35
|
RubyZen.show(options)
|
37
36
|
end
|
38
37
|
|
@@ -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)
|
@@ -1,4 +1,28 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
:en:
|
3
|
+
- :rule: Emphasize human needs more than those of the machine.
|
4
|
+
:desc:
|
5
|
+
- Put the focus more on the programmer and less on the machine.
|
6
|
+
- Often people, especially computer engineers, focus on machines.
|
7
|
+
- They think, "By doing this, the machine will run faster. By doing this, the machine will run more efficiently. "Doing this..." They are machine-centric.
|
8
|
+
- We really need to focus on people, how they make programs or how they handle applications.
|
9
|
+
- We are the bosses. They are the slaves.
|
10
|
+
- :rule: El principio de la menor sorpresa.
|
11
|
+
:desc:
|
12
|
+
- Language should behave in such a way as to minimize confusion among experienced users.
|
13
|
+
- Matz defined it this way in an interview. Everyone has a personal past.
|
14
|
+
- Someone may come from another language and may be surprised by different aspects of the language.
|
15
|
+
- Then they might say, 'I'm surprised by this feature of language, so Ruby violates the principle of least surprise.
|
16
|
+
- Wait, wait. The principle of least surprise is NOT just for you.
|
17
|
+
- The principle of least surprise means that Ruby's rules don't change. There are no exceptions.
|
18
|
+
- Once you know the rules. There are no surprises.
|
19
|
+
- :rule: Matz ha dicho que su principal objetivo era hacer un lenguaje que le divirtiera
|
20
|
+
:desc:
|
21
|
+
- For fun we will minimize programming work and possible confusion.
|
22
|
+
- That is, rule 1 and rule 2 lead to fun.
|
23
|
+
- Fun brings joy.
|
24
|
+
- Joy gives happiness.
|
25
|
+
- The Ruby path leads us to happiness!
|
2
26
|
:es:
|
3
27
|
- :rule: Enfatizar las necesidades humanas más que de las de la máquina.
|
4
28
|
:desc:
|
@@ -23,10 +47,3 @@
|
|
23
47
|
- La diversión da alegría.
|
24
48
|
- La alegría da felicidad.
|
25
49
|
- El camino Ruby nos lleva a la felicidad!
|
26
|
-
:en:
|
27
|
-
- :rule: Enfatizar las necesidades humanas más que las de la máquina.
|
28
|
-
:desc: A menudo la gente, especialmente los ingenieros en computación, se centran en las máquinas. Ellos piensan, "Haciendo esto, la máquina funcionará más rápido. Haciendo esto, la máquina funcionará de manera más eficiente. Haciendo esto..." Están centrados en las máquinas, pero en realidad necesitamos centrarnos en las personas, en cómo hacen programas o cómo manejan las aplicaciones en los ordenadores. Nosotros somos los jefes. Ellos son los esclavos.
|
29
|
-
- :rule: El principio de la menor sorpresa.
|
30
|
-
:desc: El lenguaje debe comportarse de tal manera que minimice la confusión de los usuarios experimentados.
|
31
|
-
- :rule: Matz ha dicho que su principal objetivo era hacer un lenguaje que le divirtiera
|
32
|
-
:desc: Para divertirse vamos a minimizar el trabajo de programación y la posible confusión.
|
data/lib/ruby-zen/params.rb
CHANGED
data/lib/ruby-zen/rules.rb
CHANGED
@@ -7,10 +7,13 @@ class Rules
|
|
7
7
|
@app = application
|
8
8
|
end
|
9
9
|
|
10
|
-
def show(options = { '
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
def show(options = { 'full' => false, 'step' => true })
|
11
|
+
full = options['full']
|
12
|
+
step = options['step']
|
13
|
+
|
14
|
+
full = true if step
|
15
|
+
if full
|
16
|
+
show_full(step: step)
|
14
17
|
else
|
15
18
|
show_only_names
|
16
19
|
end
|
@@ -26,7 +29,7 @@ class Rules
|
|
26
29
|
puts
|
27
30
|
end
|
28
31
|
|
29
|
-
def
|
32
|
+
def show_full(step:)
|
30
33
|
show_title
|
31
34
|
|
32
35
|
@app.rules.each_with_index do |rule, index|
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Vargas Ruiz
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -67,15 +67,16 @@ 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
|
70
71
|
- lib/ruby-zen/files/title.txt
|
71
72
|
- lib/ruby-zen/files/zenfile.yaml
|
72
73
|
- lib/ruby-zen/params.rb
|
73
74
|
- lib/ruby-zen/rules.rb
|
74
|
-
homepage: https://github.com/dvarrui/
|
75
|
+
homepage: https://github.com/dvarrui/tools/tree/main/ruby.zen.d
|
75
76
|
licenses:
|
76
77
|
- GPL-3.0
|
77
78
|
metadata: {}
|
78
|
-
post_install_message:
|
79
|
+
post_install_message:
|
79
80
|
rdoc_options: []
|
80
81
|
require_paths:
|
81
82
|
- lib
|
@@ -90,8 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
91
|
- !ruby/object:Gem::Version
|
91
92
|
version: '0'
|
92
93
|
requirements: []
|
93
|
-
rubygems_version: 3.
|
94
|
-
signing_key:
|
94
|
+
rubygems_version: 3.3.3
|
95
|
+
signing_key:
|
95
96
|
specification_version: 4
|
96
97
|
summary: Display Ruby ZEN rules
|
97
98
|
test_files: []
|