summaryrefslogtreecommitdiff
path: root/test/ruby/jarh.in.rb
blob: df2176eed9ace215fb6a22426d5545e6006e1722 (plain)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371

print ',rekcah ybuR rehtona tsuJ'.reverse

print %q/92G5S="!A;F]T:&5R(%)U8GD@:&%C:V5R+```/.unpack('u')

print %q/SnVzdCBhbm90aGVyIFJ1YnkgaGFja2VyLA==/.unpack('m')

print 'Whfg nabgure Ehol unpxre,'.tr('A-Za-z', 'N-ZA-Mn-za-m')

print({'ruby' => 'Just another Ruby hacker,'}['ruby'])

print 'jUsT aNoThEr '.capitalize, 'RuBy HaCkEr,'.capitalize

print ['Just another Ruby hacker,'][0]

print ['hacker,', 'Ruby ', 'another ', 'Just '].reverse

proc {print 'Just another Ruby hacker,'}.call

def pri() print 'Just another Ruby hacker,' end; pri

for i in 'Just another Ruby hacker,' do print i end

print `echo -n Just another Ruby hacker,`

print 'Just another Ruby hacker,'.split('')

print 'JQust aQnotQher RQuby hQackQer,'.delete('Q')

'Just another Ruby hacker,'.scan(/(.)/) {print $1}

print 'Just ' + 'another ' + 'Ruby ' + 'hacker,'

print ['4a75737420616e6f746865722052756279206861636b65722c'].pack('H*')

print 'Just another Ruby hacker,'.split(/(.)/)

print %w(Just another Ruby hacker,).join(' ')

print({'another '=>'Just ', 'hacker,'=>'Ruby '}.invert.sort)

print eval(%-eval %: %|Just another Ruby hacker,| :-)

#;eval %qPprint eval %-eval %:'Just another Ruby hacker,' :-P

print Hash.new('Just another Ruby hacker,')[:Ruby]

print ['Just ', ['another ', ['Ruby ', ['hacker,']]]].flatten

print Struct.new(*%w|Ruby Just another Ruby hacker,|)[*[0]*4].members.join(' ')

print Time.now.strftime('Just another Ruby hacker,')

print "   Just another Ruby hacker,    \r\n".strip

print ['Just ', nil, 'another ', nil, 'Ruby ', nil, 'hacker,'].compact

['hacker,', 'Ruby ', 'another ', 'Just '].reverse_each do |x| print x end

/Just another Ruby hacker,/.source.display

send :print, 'Just another Ruby hacker,'

print ['Just ', 'another ', 'Ruby '] | ['another ', 'Ruby ', 'hacker,']

print ['Just ', 'another ', 'Perl', 'Ruby ', 'hacker,'] - ['Perl']

print [['', 'Just another Ruby hacker,']].assoc('')

print ['Just another Ruby hacker,'].pack('a*')

print 'Just another Ruby hacker,'.unpack('a*')

print [['Just another Ruby hacker,'].pop].sort.shift

print [['Just another Ruby hacker,', '']].rassoc('')

{'Just another ' => 'Ruby hacker,'}.to_a.display

print 'Just another Ruby hackeq,'.succ

print 'jUST ANOTHER rUBY HACKER,'.swapcase

print ['Just another Ruby hacker,'].find {|x| x}

print %w(Just another Ruby hacker,).find_all {|x| x}.join(' ')

print %w(Just another Ruby hacker,).grep(/./).join(' ')

Ruby = 'Just another Ruby hacker,' and print Object.const_get(:Ruby)

Proc.new {print 'Just another Ruby hacker,'}[]

print 'JJuusstt  aannootthheerr  RRuubbyy  hhaacckkeerr,,'.squeeze

print [1249211252, 543256175, 1952998770, 542274914, 2032167009, 1667982706].pack('N*'), ','

$> << 'Just ' << 'another ' << 'Ruby ' << 'hacker,'

5.times do|i|'Jaebcunrykso  ettRhr hua,'.scan(/.{5}/) do print $&[i,1] end end

a=',rekcah ybuR rehtona tsuJ'.split('');print a.pop while not a.empty?

print ',Pr-eok,c"a$h! kypbquuRA %roeqhbtaoon;ab rtesbujJ&'.gsub(/(.)./, '\1').reverse

print /.*/.match('Just another Ruby hacker,')

print $& if /.*/ === 'Just another Ruby hacker,'

case 'Just another Ruby hacker,' when /.*/; print $~[0] end

print Marshal.load(Marshal.dump("Just another Ruby hacker,"))

'Just another Ruby hacker,'.each_byte do |x| print x.chr end

print '/hacker,/another /Ruby /Just '.split('/').sort.values_at(1,3,2,4)

print 'Just another Perl hacker,'.sub('Perl', 'Ruby')

#$><<'RbyckJust another,'.split('').values_at(5..16,9,0,6,1,2,9,14,10,3,4,15..17)

('a'..'y').to_a.join.tr('a-y','Just another Ruby hacker,').display

begin print 'Just another ' ensure print 'Ruby hacker,' end

'J,ursetk caanho tyhbeurR  Rruebhyt ohnaac ktesru,J'.scan(/.(.)/).reverse.display

'J,ursetk caanho tyhbeurR  Rruebhyt ohnaac ktesru,J'.gsub(/(.)./,'\1').display

a='J,ursetk caanho tyhbeurR ';0.step(24,2){|i|print a[i,1]};23.step(1,-2){|i|print a[i,1]}

a='Js nte uyhce,rka bRrhoatu'.split('');12.times{print a.shift,a.pop};print a

a='Js nte uyhce,rka bRrhoatu';begin a.sub!(/^(.)(.*)(.)$/){print $1,$3;$2}end while$1;print a

a='J Ruby hacker,ust another';11.times{a.sub!(/^(.)(.*)(.)$/,'\1\3\2')};print a

print 'Just. another! -Ruby? $hacker,'.tr_s('-.!?$ ', ' ')

' e m r,yJaRnafatbpcuekewhjhskvngohrlrxsctdtiubuoyq'.scan(/(.)(.)/).collect!{|x|[x[1],x[0]]}.sort.collect!{|x|x[1]}.display

'e m r y,aJnRfatapbuckewejhshvkgnholrxrcsdtitbuouqy'.scan(/../).sort.collect!{|x|x[1,1]}.display

'4a75737420616e6f746865722052756279206861636b65722c'.scan(/../){print $&.hex.chr}

print ['Just another Perl hacker,'].fill('Just another Ruby hacker,')

$><<{1=>'Just ',2=>'another ',3=>'Ruby ',4=>'hacker,'}.sort.to_s.delete('1-4')

Kernel.print %q<Just another Ruby hacker,>

class Just_another_Ruby_hackerq;end;print Just_another_Ruby_hackerq.to_s.tr('_q',' ,')

Kust_another_Ruby_hacker=0;print Module.constants.grep(/Kust/)[0].tr('K_','J '), ','

module Lust_another_Ruby_hackerq; print name.tr('L_q', 'J ,') end

class Bar; print 'Just another Ruby hacker,' end

class Baz; def initialize() print 'Just another Ruby hacker,' end end; Baz.new

eval "A<')I;G0@)TIU<W0@86YO=&AE<B!2=6)Y(&AA8VME<BPG".unpack('u')[0]

eval "cHJpbnQgJ0p1c3QgYW5vdGhlciBSdWJ5IGhhY2tlciwn".unpack('m')[0]

$stdout.write 'Just another Ruby hacker,'

"Just \nanother \nRuby \nhacker,\n".each do |x| print x.chomp end

print $' if /\n/x === "\nJust another Ruby hacker,"

raise 'Just another Ruby hacker,' rescue print $!

print File.basename('~/Just another Ruby hacker,.rb','.*')

proc{|x|x['Just another Ruby hacker,']}[proc{|x|print x}]

method(:print)['Just another Ruby hacker,']

'Just another Ruby hacker,'.method(:display)[]

print ''.replace('Just another Ruby hacker,')

instance_eval do print 'Just another Ruby hacker,' end

Kernel.module_eval do print 'Just another Ruby hacker,' end

print %%\%s%%%%Just another Ruby hacker,%%%%%%%%%

print !?????:???%?Just another Ruby hacker,?:??

#({}.default='Just another Ruby hacker,')[0].display

print Hash['Just another ', 'Ruby hacker,']

print 'Just ' 'another ' 'Ruby ' 'hacker,'

print File.dirname('Just another Ruby hacker,/Just another Ruby porter,')

def $_.singleton_method_added(*) print 'Just another Ruby hacker,' end

print ['Just another Ruby hacker,'].delete_at(0)

print '%s %s %s %s' % %w[Just another Ruby hacker,]

'cker,by haer RuanothJust '.scan(/.{5}/).reverse.display

(97..121).to_a.pack('c*').tr('a-y','Just another Ruby hacker,').display

'abcdefghijklmnopqrstuvwxy'.tr('a-y','Just another Ruby hacker,').display

',rekcah ybuR rehtona tsuJ'.scan(/.{1}/).reverse.display

print 'Just another Ruby hacker,'%%; (^_^;;;

print('Just another Ruby hacker,'% %- ;-)

'r,keac hbyRur heotant usJ'.scan(/.{1,2}/).reverse.display

print 'Just another Ruby hacker,' * ('Just another Ruby hacker,' =~ /u/)

print 'uJtsa onhtreR bu yahkcre,'.unpack('v12c').pack('n12c')

print 'uJtsa onhtreR bu yahkcre,'.gsub(/(.)(.?)/, '\2\1')

'uJtsa onhtreR bu yahkcre,'.scan(/(.)(.?)/){|x,y| print y+x}

print 'Just another Ruby hacker,'['Just another Ruby hacker,']

print 'Just another Ruby hacker,'[/.*/]

print [].push('Just ', 'another ', 'Ruby ', 'hacker,')

print 'Just another Ruby hacker,'[0..-1]

print 'Just another Ruby hacker,'.instance_eval{self}

class String; def +@() print self end; +'Just another Ruby hacker,' end

print '1J2u3s4t5 6a7n8o9t0h1e2r3 4R5u6b7y8 9h0a1c2k3e4r5,'.delete('0-9')

'Jaubsctd eafngohtihjekrl mRnuobpyq rhsatcukvewrx,y'.gsub(/(.)./, '\1').display

#$><<{'Just another Ruby hacker,'=>''}.default=0

print eval('Just another Ruby hacker,'.dump)

print 'Just another Ruby hacker'.concat(?,)

print 'Just another Ruby hacker,'.intern.to_s

print 'Just another Ruby hacker,'.dump[1..-2]

'Just another Ruby hacker,'.each_line do |x| print x end

['JUST ANOTHER ', 'RUBY HACKER,'].each do |x| print x.capitalize end

printf '%.25s', 'Just another Ruby hacker,JARH'

print 'Just another Ruby hacker,'.split(/Z/)[0]

print 'Just another Ruby hacker,'.split(//)

print %w.J u s t \ a n o t h e r \ R u b y \ h a c k e r ,.

print String([%[Just another Ruby hacker,]])

print catch(:x){throw :x, 'Just another Ruby hacker,'}

r,w = IO::pipe;w.print 'Just another Ruby hacker,';w.close;print r.gets

print sprintf('%s', format('%s' % '%s', 'Just another Ruby hacker,'))

print eval('Just another Ruby hacker,'.inspect)

/#{print 'Just another Ruby hacker,'}/

print 'Just another Ruby hacker,'.scan(/./).collect{|x|x[0]}.pack('U*')

print 'Just another Ruby hacker,'.scan(/./).pack('a'*25)

'Just another Ruby hacker,'.send 'yalpsid'.reverse.intern

print %w.Just another Ruby Ruby Ruby hacker,..uniq.join(' ')

{}.fetch(:x){'Just another Ruby hacker,'}.display

{}.delete(:x){'Just another Ruby hacker,'}.display

print [:x].map{'Just another Ruby hacker,'}

{'Ruby hacker,'=>'Just another'}.each{|*x|print x.reverse.join(' ')}

print [].unshift('Ruby hacker,').unshift('Just another').join(' ')

{3=>'Ruby ',2=>'another ',4=>'hacker,',1=>'Just '}.values_at(1,2,3,4).display

print [[0,'Just another Ruby hacker,'],1].first.last

{''=>'JARH'}.update(''=>'Just another Ruby hacker,').display

{:JARH => 'Just another Ruby hacker,'}.values.display

{'Just another Ruby hacker,'=>:JARH}.invert[:JARH].display

print ['Just another Ruby hacker,'=>:JARH][0].keys

print [{}].slice(0..0)[0].store('', 'Just another Ruby hacker,')

print 'Just another Ruby hacker,'.split.join(' ')

begin print 'Just another Ruby hacker,' end while false

begin rescue then else print 'Just another Ruby hacker,' end

print //.match('Just another Ruby hacker,').string

callcc{print 'Just another Ruby hacker,'}

Thread.start{print'Just another Ruby hacker,'}.join

('JARH'..'Just another Ruby hacker,').end.display

('Just another'..'Ruby hacker,').to_s.tr_s('.', ' ').display

unless true then else 'Just another Ruby hacker,' end.display

loop do print 'Just another Ruby hacker,'; break end 

1.times do print 'Just another Ruby hacker,' end

0.upto(0) do print 'Just another Ruby hacker,' end

0.downto(0) do print 'Just another Ruby hacker,' end

print Struct.new('Just_another_Ruby_hacker').to_s.split(':')[2].tr('_',' '),','

def (x='Just another Ruby hacker,').foo() print self end; x.foo

begin print 'Just another Ruby hacker,' end until true

for i in %w[Just\  another\  Ruby\  hacker,] do print i end

'Just another Ruby hacker,'.each_byte do |x| putc x end

',rekcah ybuR rehtona tsuJ'.scan(/./).reverse_each do |x| putc x end

print Regexp.quote('Just another Ruby hacker,').delete('\\')

print true ? "Just another Ruby hacker," :-P

print true ? "Just another Ruby hacker," :-D

print *("Just another Ruby hacker,".."Just another Ruby hacker,").to_a

print eval(%<%%Just another Ruby hacker,%>)

print case when true then "Just another Ruby hacker," end

print %w[Just another Ruby hacker,] * " "

begin end if print "Just another Ruby hacker,"

print begin "Just another Ruby hacker," end

print "Just another Ruby hacker,".center(10000).strip

print "Just " or print "another " or print "Ruby " or print "hacker,"

print :"Just another Ruby hacker,"