Changeset View
Changeset View
Standalone View
Standalone View
autotests/folding/highlight.rb.fold
1 | # This file is a testcase for the highlighting of Ruby code | 1 | # This file is a testcase for the highlighting of Ruby code | ||
---|---|---|---|---|---|
2 | # It's not executable code, but a collection of code snippets | 2 | # It's not executable code, but a collection of code snippets | ||
3 | # | 3 | # | ||
4 | 4 | | |||
5 | require 'Config' | 5 | require 'Config' | ||
6 | require 'DO/Clients' | 6 | require 'DO/Clients' | ||
7 | require 'DO/DBClients' | 7 | require 'DO/DBClients' | ||
8 | 8 | | |||
9 | <beginfold id='1'>def</beginfold id='1'> CGI::escapeElement(string, *elements) | 9 | <beginfold id='1'>def</beginfold id='1'> CGI::escapeElement(string, *elements) | ||
10 | elements = elements[0] if elements[0].kind_of?(Array) | 10 | elements = elements[0] if elements[0].kind_of?(Array) | ||
11 | <beginfold id='1'>unless</beginfold id='1'> elements.empty? | 11 | <beginfold id='1'>unless</beginfold id='1'> elements.empty? | ||
12 | string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/ni) <beginfold id='1'>do</beginfold id='1'> | 12 | string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/ni) <beginfold id='1'>do</beginfold id='1'> | ||
13 | CGI::escapeHTML($&) | 13 | CGI::escapeHTML($&) | ||
14 | <endfold id='1'>end</endfold id='1'> | 14 | <endfold id='1'>end</endfold id='1'> | ||
15 | <endfold id='1'>else</endfold id='1'><beginfold id='1'>else</beginfold id='1'> | 15 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> | ||
16 | string | 16 | string | ||
17 | <endfold id='1'>end</endfold id='1'> | 17 | <endfold id='1'>end</endfold id='1'> | ||
18 | <endfold id='1'>end</endfold id='1'> | 18 | <endfold id='1'>end</endfold id='1'> | ||
19 | 19 | | |||
20 | <beginfold id='1'>case</beginfold id='1'> inputLine | 20 | <beginfold id='1'>case</beginfold id='1'> inputLine | ||
21 | when "debug" | 21 | when "debug" | ||
22 | dumpDebugInfo | 22 | dumpDebugInfo | ||
23 | dumpSymbols | 23 | dumpSymbols | ||
24 | when /p\s+(\w+)/ | 24 | when /p\s+(\w+)/ | ||
25 | dumpVariable($1) | 25 | dumpVariable($1) | ||
26 | when "quit", "exit" | 26 | when "quit", "exit" | ||
27 | exit | 27 | exit | ||
28 | <endfold id='1'>else</endfold id='1'><beginfold id='1'>else</beginfold id='1'> | 28 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> | ||
29 | print "Illegal command: #{inputLine}" | 29 | print "Illegal command: #{inputLine}" | ||
30 | <endfold id='1'>end</endfold id='1'> | 30 | <endfold id='1'>end</endfold id='1'> | ||
31 | 31 | | |||
32 | 32 | | |||
33 | kind = <beginfold id='1'>case</beginfold id='1'> year #hi there | 33 | kind = <beginfold id='1'>case</beginfold id='1'> year #hi there | ||
34 | when 1850..1889 then "Blues" | 34 | when 1850..1889 then "Blues" | ||
35 | when 1890..1909 then "Ragtime" | 35 | when 1890..1909 then "Ragtime" | ||
36 | when 1910..1929 then "New Orleans Jazz" | 36 | when 1910..1929 then "New Orleans Jazz" | ||
37 | when 1930..1939 then "Swing" | 37 | when 1930..1939 then "Swing" | ||
38 | when 1940..1950 then "Bebop" | 38 | when 1940..1950 then "Bebop" | ||
39 | <endfold id='1'>else</endfold id='1'> "Jazz"<beginfold id='1'>else</beginfold id='1'> "Jazz" | 39 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> "Jazz" | ||
40 | <endfold id='1'>end</endfold id='1'> | 40 | <endfold id='1'>end</endfold id='1'> | ||
41 | 41 | | |||
42 | # URL-encode a string. | 42 | # URL-encode a string. | ||
43 | # url_encoded_string = CGI::escape("'Stop!' said Fred") | 43 | # url_encoded_string = CGI::escape("'Stop!' said Fred") | ||
44 | # # => "%27Stop%21%27+said+Fred" | 44 | # # => "%27Stop%21%27+said+Fred" | ||
45 | <beginfold id='1'>def</beginfold id='1'> CGI::escape(string) | 45 | <beginfold id='1'>def</beginfold id='1'> CGI::escape(string) | ||
46 | string.gsub(/([^ a-zA-Z0-9_.-]+)/n) <beginfold id='1'>do</beginfold id='1'> | 46 | string.gsub(/([^ a-zA-Z0-9_.-]+)/n) <beginfold id='1'>do</beginfold id='1'> | ||
47 | '%' + $1.unpack('H2' * $1.size).join('%').upcase | 47 | '%' + $1.unpack('H2' * $1.size).join('%').upcase | ||
Show All 16 Lines | |||||
64 | <endfold id='1'>end</endfold id='1'> | 64 | <endfold id='1'>end</endfold id='1'> | ||
65 | 65 | | |||
66 | <beginfold id='1'>if</beginfold id='1'> artist == "John Coltrane" #hi there | 66 | <beginfold id='1'>if</beginfold id='1'> artist == "John Coltrane" #hi there | ||
67 | artist = "'Trane" #hi there | 67 | artist = "'Trane" #hi there | ||
68 | <endfold id='1'>end</endfold id='1'> unless nicknames == "no" #hi there | 68 | <endfold id='1'>end</endfold id='1'> unless nicknames == "no" #hi there | ||
69 | 69 | | |||
70 | handle <beginfold id='1'>= if</beginfold id='1'> aSong.artist == "Gillespie" then #hi there | 70 | handle <beginfold id='1'>= if</beginfold id='1'> aSong.artist == "Gillespie" then #hi there | ||
71 | "Dizzy" | 71 | "Dizzy" | ||
72 | <endfold id='1'>elsif</endfold id='1'> aSong.artist == "Parker" then<beginfold id='1'>elsif</beginfold id='1'> aSong.artist == "Parker" then | 72 | <endfold id='1'></endfold id='1'><beginfold id='1'>elsif</beginfold id='1'> aSong.artist == "Parker" then | ||
73 | "Bird" | 73 | "Bird" | ||
74 | <endfold id='1'>else</endfold id='1'> #hi there<beginfold id='1'>else</beginfold id='1'> #hi there | 74 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> #hi there | ||
75 | "unknown" | 75 | "unknown" | ||
76 | <endfold id='1'>end</endfold id='1'> | 76 | <endfold id='1'>end</endfold id='1'> | ||
77 | 77 | | |||
78 | <beginfold id='1'>if</beginfold id='1'> aSong.artist == "Gillespie" then handle = "Dizzy" | 78 | <beginfold id='1'>if</beginfold id='1'> aSong.artist == "Gillespie" then handle = "Dizzy" | ||
79 | <endfold id='1'>elsif</endfold id='1'> aSong.artist == "Parker" then handle = "Bird"<beginfold id='1'>elsif</beginfold id='1'> aSong.artist == "Parker" then handle = "Bird" | 79 | <endfold id='1'></endfold id='1'><beginfold id='1'>elsif</beginfold id='1'> aSong.artist == "Parker" then handle = "Bird" | ||
80 | <endfold id='1'>else</endfold id='1'> handle = "unknown"<beginfold id='1'>else</beginfold id='1'> handle = "unknown" | 80 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> handle = "unknown" | ||
81 | <endfold id='1'>end</endfold id='1'> #hi there | 81 | <endfold id='1'>end</endfold id='1'> #hi there | ||
82 | 82 | | |||
83 | <beginfold id='1'>if</beginfold id='1'> aSong.artist == "Gillespie" then | 83 | <beginfold id='1'>if</beginfold id='1'> aSong.artist == "Gillespie" then | ||
84 | handle = "Dizzy" | 84 | handle = "Dizzy" | ||
85 | <endfold id='1'>elsif</endfold id='1'> aSong.artist == "Parker" then<beginfold id='1'>elsif</beginfold id='1'> aSong.artist == "Parker" then | 85 | <endfold id='1'></endfold id='1'><beginfold id='1'>elsif</beginfold id='1'> aSong.artist == "Parker" then | ||
86 | handle = "Bird" | 86 | handle = "Bird" | ||
87 | <endfold id='1'>else</endfold id='1'><beginfold id='1'>else</beginfold id='1'> | 87 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> | ||
88 | handle = "unknown" | 88 | handle = "unknown" | ||
89 | <endfold id='1'>end</endfold id='1'> | 89 | <endfold id='1'>end</endfold id='1'> | ||
90 | 90 | | |||
91 | <beginfold id='1'>if</beginfold id='1'> aSong.artist == "Gillespie" | 91 | <beginfold id='1'>if</beginfold id='1'> aSong.artist == "Gillespie" | ||
92 | handle = "Dizzy" | 92 | handle = "Dizzy" | ||
93 | <endfold id='1'>elsif</endfold id='1'> aSong.artist == "Parker"<beginfold id='1'>elsif</beginfold id='1'> aSong.artist == "Parker" | 93 | <endfold id='1'></endfold id='1'><beginfold id='1'>elsif</beginfold id='1'> aSong.artist == "Parker" | ||
94 | handle = "Bird" | 94 | handle = "Bird" | ||
95 | <endfold id='1'>else</endfold id='1'><beginfold id='1'>else</beginfold id='1'> | 95 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> | ||
96 | handle = "unknown" | 96 | handle = "unknown" | ||
97 | <endfold id='1'>end</endfold id='1'> | 97 | <endfold id='1'>end</endfold id='1'> | ||
98 | 98 | | |||
99 | <beginfold id='1'>case</beginfold id='1'> line | 99 | <beginfold id='1'>case</beginfold id='1'> line | ||
100 | when /title=(.*)/ | 100 | when /title=(.*)/ | ||
101 | puts "Title is #$1" | 101 | puts "Title is #$1" | ||
102 | when /track=(.*)/ | 102 | when /track=(.*)/ | ||
103 | puts "Track is #$1" | 103 | puts "Track is #$1" | ||
104 | when /artist=(.*)/ | 104 | when /artist=(.*)/ | ||
105 | puts "Artist is #$1" | 105 | puts "Artist is #$1" | ||
106 | <endfold id='1'>end</endfold id='1'> | 106 | <endfold id='1'>end</endfold id='1'> | ||
107 | 107 | | |||
108 | <beginfold id='1'>case</beginfold id='1'> shape | 108 | <beginfold id='1'>case</beginfold id='1'> shape | ||
109 | when Square, Rectangle | 109 | when Square, Rectangle | ||
110 | # ... | 110 | # ... | ||
111 | when Circle | 111 | when Circle | ||
112 | # ... | 112 | # ... | ||
113 | when Triangle | 113 | when Triangle | ||
114 | # ... | 114 | # ... | ||
115 | <endfold id='1'>else</endfold id='1'><beginfold id='1'>else</beginfold id='1'> | 115 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> | ||
116 | # ... | 116 | # ... | ||
117 | <endfold id='1'>end</endfold id='1'> | 117 | <endfold id='1'>end</endfold id='1'> | ||
118 | 118 | | |||
119 | 119 | | |||
120 | <beginfold id='1'>until</beginfold id='1'> playList.duration > 60 #hi there | 120 | <beginfold id='1'>until</beginfold id='1'> playList.duration > 60 #hi there | ||
121 | playList.add(songList.pop) | 121 | playList.add(songList.pop) | ||
122 | <endfold id='1'>end</endfold id='1'> | 122 | <endfold id='1'>end</endfold id='1'> | ||
123 | 123 | | |||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | |||||
190 | i = 0 | 190 | i = 0 | ||
191 | doUntil(i > 3) <beginfold id='1'>{</beginfold id='1'> | 191 | doUntil(i > 3) <beginfold id='1'>{</beginfold id='1'> | ||
192 | print i, " " | 192 | print i, " " | ||
193 | i += 1 | 193 | i += 1 | ||
194 | <endfold id='1'>}</endfold id='1'> | 194 | <endfold id='1'>}</endfold id='1'> | ||
195 | 195 | | |||
196 | <beginfold id='1'>def</beginfold id='1'> system_call | 196 | <beginfold id='1'>def</beginfold id='1'> system_call | ||
197 | # ... code which throws SystemCallError | 197 | # ... code which throws SystemCallError | ||
198 | <endfold id='1'>rescue</endfold id='1'> SystemCallError<beginfold id='1'>rescue</beginfold id='1'> SystemCallError | 198 | <endfold id='1'></endfold id='1'><beginfold id='1'>rescue</beginfold id='1'> SystemCallError | ||
199 | $stderr.print "IO failed: " + $! | 199 | $stderr.print "IO failed: " + $! | ||
200 | opFile.close | 200 | opFile.close | ||
201 | File.delete(opName) | 201 | File.delete(opName) | ||
202 | raise | 202 | raise | ||
203 | <endfold id='1'>end</endfold id='1'> | 203 | <endfold id='1'>end</endfold id='1'> | ||
204 | 204 | | |||
205 | <beginfold id='1'>class</beginfold id='1'> ClientManager | 205 | <beginfold id='1'>class</beginfold id='1'> ClientManager | ||
206 | 206 | | |||
Show All 13 Lines | |||||
220 | # update the clients object by retrieving the related data from the database | 220 | # update the clients object by retrieving the related data from the database | ||
221 | # returns the number of clients | 221 | # returns the number of clients | ||
222 | <beginfold id='1'>def</beginfold id='1'> refreshClients | 222 | <beginfold id='1'>def</beginfold id='1'> refreshClients | ||
223 | @clients.clean | 223 | @clients.clean | ||
224 | <beginfold id='1'>unless</beginfold id='1'> @sqlQuery.nil? then | 224 | <beginfold id='1'>unless</beginfold id='1'> @sqlQuery.nil? then | ||
225 | @sqlQuery.selectClient.each <beginfold id='1'>do</beginfold id='1'> |row| | 225 | @sqlQuery.selectClient.each <beginfold id='1'>do</beginfold id='1'> |row| | ||
226 | @clients.addClient(row[0],row[1],row[2],row[3],row[4],row[5], row[6], row[7], row[8]) | 226 | @clients.addClient(row[0],row[1],row[2],row[3],row[4],row[5], row[6], row[7], row[8]) | ||
227 | <endfold id='1'>end</endfold id='1'> | 227 | <endfold id='1'>end</endfold id='1'> | ||
228 | <endfold id='1'>else</endfold id='1'><beginfold id='1'>else</beginfold id='1'> | 228 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> | ||
229 | puts "SqlQuery wasn't created : cannot read data from database" | 229 | puts "SqlQuery wasn't created : cannot read data from database" | ||
230 | <endfold id='1'>end</endfold id='1'> | 230 | <endfold id='1'>end</endfold id='1'> | ||
231 | return @clients.length | 231 | return @clients.length | ||
232 | <endfold id='1'>end</endfold id='1'> | 232 | <endfold id='1'>end</endfold id='1'> | ||
233 | 233 | | |||
234 | # insert a client in the database and refreshes the local clients object | 234 | # insert a client in the database and refreshes the local clients object | ||
235 | # we assume that none of the arguments is null | 235 | # we assume that none of the arguments is null | ||
236 | # we assume that the client, identified by raison_sociale doesn't already exists | 236 | # we assume that the client, identified by raison_sociale doesn't already exists | ||
237 | <beginfold id='1'>def</beginfold id='1'> addClient(raison_sociale, division, departement, adresse, cp, ville, nom_contact, tel_contact) | 237 | <beginfold id='1'>def</beginfold id='1'> addClient(raison_sociale, division, departement, adresse, cp, ville, nom_contact, tel_contact) | ||
238 | id = "0" | 238 | id = "0" | ||
239 | <beginfold id='1'>unless</beginfold id='1'> @sqlQuery.nil? then | 239 | <beginfold id='1'>unless</beginfold id='1'> @sqlQuery.nil? then | ||
240 | id = @sqlQuery.insertClient(raison_sociale, division, departement, adresse, cp, ville, nom_contact,tel_contact) | 240 | id = @sqlQuery.insertClient(raison_sociale, division, departement, adresse, cp, ville, nom_contact,tel_contact) | ||
241 | <endfold id='1'>else</endfold id='1'><beginfold id='1'>else</beginfold id='1'> | 241 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> | ||
242 | puts "SqlQuery wasn't created : database update cannot be performed" | 242 | puts "SqlQuery wasn't created : database update cannot be performed" | ||
243 | <endfold id='1'>end</endfold id='1'> | 243 | <endfold id='1'>end</endfold id='1'> | ||
244 | @clients.addClient(id, raison_sociale, division, departement, adresse, cp, ville, nom_contact, tel_contact) # synchronize local object with DB | 244 | @clients.addClient(id, raison_sociale, division, departement, adresse, cp, ville, nom_contact, tel_contact) # synchronize local object with DB | ||
245 | <endfold id='1'>end</endfold id='1'> | 245 | <endfold id='1'>end</endfold id='1'> | ||
246 | 246 | | |||
247 | # deletes a client from the database and updates the local Clients object accordingly | 247 | # deletes a client from the database and updates the local Clients object accordingly | ||
248 | <beginfold id='1'>def</beginfold id='1'> delClient(nomclient_brut) | 248 | <beginfold id='1'>def</beginfold id='1'> delClient(nomclient_brut) | ||
249 | raison_sociale, div, dep = Clients.getIdentifiers(nomclient_brut) | 249 | raison_sociale, div, dep = Clients.getIdentifiers(nomclient_brut) | ||
250 | listeContratsExp, listeContratsSup, listeContratsProd, listePropositionsExp, listePropositionsSup = [] | 250 | listeContratsExp, listeContratsSup, listeContratsProd, listePropositionsExp, listePropositionsSup = [] | ||
251 | 251 | | |||
252 | listeContratsExp = @contratsExpertise.getContratsFromClient(nomclient_brut) | 252 | listeContratsExp = @contratsExpertise.getContratsFromClient(nomclient_brut) | ||
253 | listeContratsSup = @contratsSupport.getContratsFromClient(nomclient_brut) | 253 | listeContratsSup = @contratsSupport.getContratsFromClient(nomclient_brut) | ||
254 | listeContratsProd = @contratsProduits.getContratsFromClient(nomclient_brut) | 254 | listeContratsProd = @contratsProduits.getContratsFromClient(nomclient_brut) | ||
255 | listePropositionsExp = @propositionsExpertise.getPropositionsFromClient(nomclient_brut) | 255 | listePropositionsExp = @propositionsExpertise.getPropositionsFromClient(nomclient_brut) | ||
256 | listePropositionsSup = @propositionsSupport.getPropositionsFromClient(nomclient_brut) | 256 | listePropositionsSup = @propositionsSupport.getPropositionsFromClient(nomclient_brut) | ||
257 | 257 | | |||
258 | <beginfold id='1'>unless</beginfold id='1'> @sqlQuery.nil? then | 258 | <beginfold id='1'>unless</beginfold id='1'> @sqlQuery.nil? then | ||
259 | @sqlQuery.deleteClient(raison_sociale, div, dep) | 259 | @sqlQuery.deleteClient(raison_sociale, div, dep) | ||
260 | 260 | | |||
261 | @sqlQuery.deleteContracts(Config::EXPERTISE,listeContratsExp) | 261 | @sqlQuery.deleteContracts(Config::EXPERTISE,listeContratsExp) | ||
262 | @sqlQuery.deleteContracts(Config::SUPPORT,listeContratsSup) | 262 | @sqlQuery.deleteContracts(Config::SUPPORT,listeContratsSup) | ||
263 | @sqlQuery.deleteContracts(Config::PRODUIT,listeContratsProd) | 263 | @sqlQuery.deleteContracts(Config::PRODUIT,listeContratsProd) | ||
264 | @sqlQuery.deletePropositions(Config::EXPERTISE,listePropositionsExp) | 264 | @sqlQuery.deletePropositions(Config::EXPERTISE,listePropositionsExp) | ||
265 | @sqlQuery.deletePropositions(Config::SUPPORT,listePropositionsSup) | 265 | @sqlQuery.deletePropositions(Config::SUPPORT,listePropositionsSup) | ||
266 | <endfold id='1'>else</endfold id='1'><beginfold id='1'>else</beginfold id='1'> | 266 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> | ||
267 | puts "SqlQuery wasn't created : database update cannot be performed" | 267 | puts "SqlQuery wasn't created : database update cannot be performed" | ||
268 | <endfold id='1'>end</endfold id='1'> | 268 | <endfold id='1'>end</endfold id='1'> | ||
269 | @clients.delClient(raison_sociale,div,dep) | 269 | @clients.delClient(raison_sociale,div,dep) | ||
270 | 270 | | |||
271 | @contratsExpertise.deleteContracts(listeContratsExp) | 271 | @contratsExpertise.deleteContracts(listeContratsExp) | ||
272 | @contratsSupport.deleteContracts(listeContratsSup) | 272 | @contratsSupport.deleteContracts(listeContratsSup) | ||
273 | @contratsProduits.deleteContracts(listeContratsProd) | 273 | @contratsProduits.deleteContracts(listeContratsProd) | ||
274 | @propositionsExpertise.deletePropositions(listePropositionsExp) | 274 | @propositionsExpertise.deletePropositions(listePropositionsExp) | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 284 | <beginfold id='5'> %</beginfold id='5'>|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><endfold id='5'>|</endfold id='5'> | |||
326 | <endfold id='1'>end</endfold id='1'> | 326 | <endfold id='1'>end</endfold id='1'> | ||
327 | 327 | | |||
328 | # following snippet from Webrick's log.rb | 328 | # following snippet from Webrick's log.rb | ||
329 | # notice the erronous handling of the query method is_a? | 329 | # notice the erronous handling of the query method is_a? | ||
330 | <beginfold id='1'>def</beginfold id='1'> format(arg) | 330 | <beginfold id='1'>def</beginfold id='1'> format(arg) | ||
331 | str <beginfold id='1'>= if</beginfold id='1'> arg.is_a?(Exception) | 331 | str <beginfold id='1'>= if</beginfold id='1'> arg.is_a?(Exception) | ||
332 | "#{arg.class}: #{arg.message}\n\t" << | 332 | "#{arg.class}: #{arg.message}\n\t" << | ||
333 | arg.backtrace.join("\n\t") << "\n" | 333 | arg.backtrace.join("\n\t") << "\n" | ||
334 | <endfold id='1'>elsif</endfold id='1'> arg.respond_to?(:to_str)<beginfold id='1'>elsif</beginfold id='1'> arg.respond_to?(:to_str) | 334 | <endfold id='1'></endfold id='1'><beginfold id='1'>elsif</beginfold id='1'> arg.respond_to?(:to_str) | ||
335 | arg.to_str | 335 | arg.to_str | ||
336 | <endfold id='1'>else</endfold id='1'><beginfold id='1'>else</beginfold id='1'> | 336 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> | ||
337 | arg.inspect | 337 | arg.inspect | ||
338 | <endfold id='1'>end</endfold id='1'> | 338 | <endfold id='1'>end</endfold id='1'> | ||
339 | <endfold id='1'>end</endfold id='1'> | 339 | <endfold id='1'>end</endfold id='1'> | ||
340 | 340 | | |||
341 | # following snippet from Webrick's httputils.rb | 341 | # following snippet from Webrick's httputils.rb | ||
342 | # Splitting regexps on several lines might be bad form, | 342 | # Splitting regexps on several lines might be bad form, | ||
343 | # but not illegal in Ruby. | 343 | # but not illegal in Ruby. | ||
344 | # This should probably be supported in the highlighting | 344 | # This should probably be supported in the highlighting | ||
▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Line(s) | 497 | <beginfold id='1'>def</beginfold id='1'> send_data(data) | |||
503 | when Integer | 503 | when Integer | ||
504 | send_number_data(data) | 504 | send_number_data(data) | ||
505 | when Array | 505 | when Array | ||
506 | send_list_data(data) | 506 | send_list_data(data) | ||
507 | when Time | 507 | when Time | ||
508 | send_time_data(data) | 508 | send_time_data(data) | ||
509 | when Symbol | 509 | when Symbol | ||
510 | send_symbol_data(data) | 510 | send_symbol_data(data) | ||
511 | <endfold id='1'>else</endfold id='1'><beginfold id='1'>else</beginfold id='1'> | 511 | <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> | ||
512 | data.send_data(self) | 512 | data.send_data(self) | ||
513 | <endfold id='1'>end</endfold id='1'> | 513 | <endfold id='1'>end</endfold id='1'> | ||
514 | <endfold id='1'>end</endfold id='1'> | 514 | <endfold id='1'>end</endfold id='1'> | ||
515 | 515 | | |||
516 | # snippet from Net::POP | 516 | # snippet from Net::POP | ||
517 | # class names can have numbers in them as long as they don't begin with numbers | 517 | # class names can have numbers in them as long as they don't begin with numbers | ||
518 | # Ruby doesn't internally really make much of a difference between a class name and a constant | 518 | # Ruby doesn't internally really make much of a difference between a class name and a constant | ||
519 | 519 | | |||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |