public
Description: Tradução do livro Why's (Poignant) Guide to Ruby para português.
Homepage: http://poignantguide.net/ruby/
Clone URL: git://github.com/carlosbrando/poignant-br.git
Tradução feita por RafaelFBittencourt.
carlosbrando (author)
Wed Aug 27 07:08:21 -0700 2008
commit  5d8483dd98a41ba19e125e20881da10fcfedc366
tree    c98a9714ff1d1991f81dbbc42f4ba7e2f13e8605
parent  a1c8f4ca8d74841130b837a3353ffe671c35f7f0
...
1
2
 
3
4
5
6
7
8
9
10
 
 
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
59
60
61
 
 
 
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
84
85
86
 
 
 
87
88
89
90
91
92
93
94
 
 
 
 
 
 
 
95
96
97
98
99
100
101
 
 
 
 
 
 
102
103
104
105
106
 
 
 
 
107
108
109
...
1
 
2
3
 
 
 
 
 
 
 
4
5
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 
 
 
54
55
56
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
 
 
79
80
81
82
 
 
 
 
 
 
 
83
84
85
86
87
88
89
90
 
 
 
 
 
 
91
92
93
94
95
96
97
 
 
 
 
98
99
100
101
102
103
104
0
@@ -1,109 +1,104 @@
0
     - >
0
- "So what? You don't think animals with tentacles can drive?"
0
+ "E então? Você não acha que animais com tentáculos podem dirigir?"
0
 
0
-
0
- "Well, not only is he going to flub up the steering wheel but he has all these
0
- legs all over the foot pedals. This is not smart. Let's get another bus. Come on."
0
-
0
-
0
- "You know, he's probably been driving like that all day. Is he really going to
0
- start crashing at this point in his career?"
0
+ "Bem, não é só ele que vai se dar mal ao volante, mas ele tem todas essas
0
+ pernas em cima dos pedais. Isso não é inteligente. Vamos pegar outro ônibus. Vamos lá."
0
         
0
-
0
- "Buses do crash," said Fox Small. "Some do. This smells crashworthy."
0
-
0
-
0
- "Sheer doo-doo!" And Fox Tall yelled to the driver, "Hey, cabby, how long
0
- have you been driving this bus for?"
0
-
0
-
0
- The bus driver peered over darkly under his cap and started to turn toward them, but his
0
- tentacles were stuck to the wheel. He jerked swiftly at his forelegs and, failing their
0
- release, he turned to the wheel and focused his energies on milking his glands for some
0
- slicker secretions. Bubbles of mucus oozed.
0
-
0
-
0
- "Let's get outta here," said Fox Tall and the two ran off into the street, slamming right
0
- into the cat Blix.
0
-
0
-
0
- "Alright, well, the bus is full," said Blix. "I don't know why the driver stopped if he knew the
0
- bus was crammed with hoppers."
0
-
0
-
0
- "We're thinking he was about to crash into us," said Fox Tall, "and he opened the
0
- door to make it look like a planned route stop."
0
-
0
-
0
- "Keep in mind, Blix, we hadn't really discussed that possibility out loud, so I haven't had a chance
0
- to formally agree," said Fox Small. "Nevertheless, it sounds rational to me."
0
-
0
-
0
- "I'm thinking all the buses are going to be full like this." Blix bit his lip,
0
- thinking and flicking his eyes about. "Let's just--" He pointed down the circuitry
0
- of apartment buildings that wound to the south. "But maybe--" He looked up and surveyed the stars,
0
- scratching his head and counting the constellations with very small poking motions
0
- from the tip of his finger.
0
-
0
-
0
- "Are you getting our bearings from the stars and planets?" asked Fox Small.
0
-
0
-
0
- Blix didn't speak, he ducked off to the north through a poorly laid avenue
0
- back behind the paint store.
0
- But before we follow them down that service road, Smotchkkiss, I have one more
0
- frog for you, perched on a long lilypad that stretches out to hold anything at all.
0
-
0
-
0
+ "Você sabe, ele está provavelmente sendo conduzido como todos os dias. Será que ele vai realmente
0
+ começar bater nesta fase da carreira dele?"
0
+
0
+ "Os ônibus batem", disse a Raposa Pequena. "Alguns fazem. Isto é uma suspeita de grande resistência".
0
+
0
+
0
+ "Desvia bobo!" e a Raposa Alta gritou para o motorista, "Ei, taxista, há quanto tempo
0
+ estás dirigindo este ônibus?"
0
+
0
+ O motorista do ônibus olhou misteriosamente por baixo da aba do seu boné e começou a virar em direção a eles, mas os seus
0
+ tentáculos ficaram presos à roda. Ele jogou para longe rapidamente a sua perna da frente e, na sua falta
0
+ soltou, ele virou-se para a roda e concentrou as suas energias na ordenha de suas glândulas para algumas
0
+ astutas secreções. Bolhas de muco gotejaram.
0
+
0
+ "Vamos ficar fora daqui", disse a Raposa Alta e os dois correram para fora da rua, batendo direto
0
+ no gato Blix.
0
+
0
+
0
+ "Está bem, assim, o ônibus está cheio," disse Blix. "Eu não sei por que o motorista parou se ele sabia que o
0
+ ônibus estava cheio com gafanhotos."
0
+
0
+
0
+ "Nós estamos pensando que ele estava prestes a bater contra nós," disse a Raposa Alta, "e ele abriu a
0
+ porta para fazer aparecer como uma parada de uma rota planejada."
0
+
0
+
0
+ "Tenha em mente, Blix, nós não tínhamos realmente discutido essa possibilidade em voz alta, então eu não tive uma chance
0
+ para formalmente concordar," disse a Raposa Pequena. "No entanto, isto parece racional para mim."
0
+
0
+
0
+ "Eu estou pensando que todos os ônibus vão estar cheio como este." Blix mordeu seu lábio,
0
+ pensando e deu um tapa sobre seus olhos. "Vamos apenas--" Ele apontou abaixo o circuito
0
+ de construções de apartamento que mudariam para o sul. "Mas talvez--" Ele olhou para cima e avaliou as estrelas,
0
+ coçando a cabeça e contando as constelações com pequenos toques de emoções
0
+ a partir da ponta de seu dedo.
0
+
0
+
0
+ "Você está recebendo o nosso comportamento a partir das estrelas e planetas?" perguntou a Raposa Pequena.
0
+
0
+
0
+ Blix não falava, ele abaixou a cabeça para o norte através de uma avenida uma avenida mal colocada
0
+ voltar atrás da loja de tinta.
0
+ Mas antes que nós os sigamos em baixo nessa estrada de serviço, Smotchkkiss, Eu tenho mais um
0
+ sapo para você, empoleirados sobre uma longa vitória régia que esticadas para fora para prender alguma coisa em tudo.
0
+
0
+
0
         <pre>
0
- irb> cat = "Blix"
0
- irb> puts "Does #{ cat } see what's up? Is #{ cat } aware??"
0
- => "Does Blix see what's up? Is Blix aware??"
0
+ irb> gato = "Blix"
0
+ irb> puts "O #{ gato } vê o que esta rolando? Está o #{ gato } prevenido??"
0
+ => "O Blix vê o que esta rolando? Está o Blix prevenido??"
0
         </pre>
0
-
0
-
0
- The little frogs from earlier (@%s@ or @%d@) were only placeholders for
0
- single strings. Saving places in the string.
0
-
0
-
0
- The lilypads above start with a flower bud, the *octothorpe*. You've also
0
- seen it as a pound sign on telephones. After the flower bud, two leaves
0
- form the edges of the lilypad. The leaves are *curly braces*, also seen many
0
- times before as the _crab pincers_ for a code block.
0
-
0
-
0
- bq. An empty lilypad @"#{}"@ becomes an empty string @""@.
0
-
0
-
0
- When the lilypad is found in a *double-quoted* string, Ruby runs any code found in between
0
- the two leaves of the lilypad. The lilypad is lifted out and the result of the code is placed there in
0
- the string. This lilypad swap is called _string interpolation_.
0
-
0
-
0
+
0
+
0
+ Os pequenos sapos desde de mais cedo (@%s@ ou @%d@) eram apenas para incógnitas para
0
+ strings únicas. Salvando lugares na string.
0
+
0
+
0
+ As vitórias régias começam com um broto de uma flor, a (*cerquilha*.) Você também
0
+ é visto como um sinal da libra em telefones. Depois os brotos das flores, duas folhas
0
+ formam as bordas da vitória régia. As folhas são *atadas e enroladas*, também visto muitas
0
+ vezes antes que o (_caranguejo pinça_) para um bloco de código.
0
+
0
+
0
+ bq. Uma vitória régia vazia @"#{}"@ se torna uma string vazia @""@.
0
+
0
+
0
+ Quando a vitória régia é encontrado numa com string em *aspas duplas*, Ruby executa algum código encontrado entre
0
+ as duas folhas da vitória régia. A vitória régia levantou-se e o resultado do código é colocado numa
0
+ string. Esta troca da vitória régia é chamada de _interpolação de string_.
0
+
0
+
0
         <pre>
0
- irb> fellows = ['Blix', 'Fox Tall', 'Fox Small']
0
- irb> puts "Let us follow #{ fellows.join ' and ' } on their journey."
0
- => "Let us follow Blix and Fox Tall and Fox Small on their journey."
0
+ irb> companheiros = ['Blix', 'Raposa Alta', 'Raposa Pequena']
0
+ irb> puts "Deixe-nos seguir #{ companheiros.join ' e ' } em sua viajem."
0
+ => "Deixe-nos seguir Blix e Raposa Alta e Raposa Pequena em sua viajem."
0
         </pre>
0
-
0
-
0
- The lilypad is very durable and can hold any kind of code inside. Above
0
- we are using @Array#join@, but you can do anything you like inside. Call
0
- object methods, conditional @if@ or @case@ statements, even define classes.
0
-
0
-
0
+
0
+
0
+ A vitória régia é muito durável e pode conter qualquer tipo de código em seu interior. Acima
0
+ nós estamos usando @Array#join@, mas você pode fazer qualquer coisa no interior que você queira. Chamar
0
+ métodos de objeto, condicional de declarações @if@ ou @case@, até mesmo definir classes.
0
+
0
+
0
         <pre>
0
- irb> blix_went = :north
0
- irb> puts "Blix didn't speak, he ducked off to the #{ blix_went } through #{
0
- if blix_went == :north
0
- 'a poorly laid avenue behind the paint store'
0
- elsif blix_went == :south
0
- 'the circuitry of apartment buildings'
0
+ irb> blix_foi = :norte
0
+ irb> puts "Blix não falou, ele abaixou a cabeça para o #{ blix_foi } através #{
0
+ if blix_foi == :norte
0
+ 'de uma avenida mal colocada atrás da loja de tinta'
0
+ elsif blix_foi == :sul
0
+ 'o circuito de construções de apartamento'
0
                      else
0
- '... well, who knows where he went.'
0
- end }. But before we follow them..."
0
- => "Blix didn't speak, he ducked off to the north through a poorly laid avenue
0
- behind the paint store. But before we follow them..."
0
+ '... Bem, quem sabe onde ele foi.'
0
+ end }. Mas antes que nós os seguimos..."
0
+ => "Blix não falou, ele abaixou a cabeça para o norte através de uma avenida mal colocada
0
+ atrás da loja de tinta. Mas antes que nós os seguimos..."
0
         </pre>
0
 
0
 

Comments

    No one has commented yet.