ripper2ruby 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README.markdown +10 -0
- data/lib/core_ext/array/flush.rb +5 -0
- data/lib/core_ext/hash/delete_at.rb +5 -0
- data/lib/core_ext/object/meta_class.rb +5 -0
- data/lib/core_ext/object/try.rb +12 -0
- data/lib/erb/stripper.rb +48 -0
- data/lib/highlighters/ansi.rb +29 -0
- data/lib/ripper/event_log.rb +45 -0
- data/lib/ripper/ruby_builder.rb +168 -0
- data/lib/ripper/ruby_builder/buffer.rb +34 -0
- data/lib/ripper/ruby_builder/events/args.rb +40 -0
- data/lib/ripper/ruby_builder/events/array.rb +71 -0
- data/lib/ripper/ruby_builder/events/assignment.rb +55 -0
- data/lib/ripper/ruby_builder/events/block.rb +80 -0
- data/lib/ripper/ruby_builder/events/call.rb +123 -0
- data/lib/ripper/ruby_builder/events/case.rb +17 -0
- data/lib/ripper/ruby_builder/events/const.rb +47 -0
- data/lib/ripper/ruby_builder/events/for.rb +13 -0
- data/lib/ripper/ruby_builder/events/hash.rb +24 -0
- data/lib/ripper/ruby_builder/events/identifier.rb +41 -0
- data/lib/ripper/ruby_builder/events/if.rb +37 -0
- data/lib/ripper/ruby_builder/events/lexer.rb +159 -0
- data/lib/ripper/ruby_builder/events/literal.rb +47 -0
- data/lib/ripper/ruby_builder/events/method.rb +21 -0
- data/lib/ripper/ruby_builder/events/operator.rb +23 -0
- data/lib/ripper/ruby_builder/events/statements.rb +50 -0
- data/lib/ripper/ruby_builder/events/string.rb +117 -0
- data/lib/ripper/ruby_builder/events/symbol.rb +22 -0
- data/lib/ripper/ruby_builder/events/while.rb +27 -0
- data/lib/ripper/ruby_builder/queue.rb +33 -0
- data/lib/ripper/ruby_builder/stack.rb +125 -0
- data/lib/ripper/ruby_builder/token.rb +91 -0
- data/lib/ripper2ruby.rb +1 -0
- data/lib/ruby.rb +28 -0
- data/lib/ruby/aggregate.rb +71 -0
- data/lib/ruby/alternation/args.rb +25 -0
- data/lib/ruby/alternation/hash.rb +25 -0
- data/lib/ruby/alternation/list.rb +19 -0
- data/lib/ruby/args.rb +36 -0
- data/lib/ruby/array.rb +27 -0
- data/lib/ruby/assignment.rb +32 -0
- data/lib/ruby/assoc.rb +17 -0
- data/lib/ruby/block.rb +42 -0
- data/lib/ruby/call.rb +34 -0
- data/lib/ruby/case.rb +30 -0
- data/lib/ruby/const.rb +49 -0
- data/lib/ruby/for.rb +18 -0
- data/lib/ruby/hash.rb +14 -0
- data/lib/ruby/if.rb +35 -0
- data/lib/ruby/list.rb +40 -0
- data/lib/ruby/literal.rb +45 -0
- data/lib/ruby/method.rb +19 -0
- data/lib/ruby/node.rb +47 -0
- data/lib/ruby/node/composite.rb +68 -0
- data/lib/ruby/node/conversions.rb +66 -0
- data/lib/ruby/node/position.rb +35 -0
- data/lib/ruby/node/source.rb +29 -0
- data/lib/ruby/node/text.rb +121 -0
- data/lib/ruby/node/traversal.rb +82 -0
- data/lib/ruby/operator.rb +49 -0
- data/lib/ruby/params.rb +41 -0
- data/lib/ruby/statements.rb +45 -0
- data/lib/ruby/string.rb +40 -0
- data/lib/ruby/symbol.rb +27 -0
- data/lib/ruby/token.rb +51 -0
- data/lib/ruby/while.rb +32 -0
- data/test/all.rb +3 -0
- data/test/builder/stack_test.rb +67 -0
- data/test/builder/text_test.rb +118 -0
- data/test/context_test.rb +54 -0
- data/test/erb_stripper_test.rb +29 -0
- data/test/fixtures/all.rb.src +150 -0
- data/test/fixtures/source_1.rb +16 -0
- data/test/fixtures/source_2.rb +1 -0
- data/test/fixtures/stuff.rb +371 -0
- data/test/fixtures/template.html.erb +22 -0
- data/test/fixtures/tmp.rb +6 -0
- data/test/lib_test.rb +92 -0
- data/test/lib_test_helper.rb +103 -0
- data/test/libs.txt +227 -0
- data/test/nodes/args_test.rb +100 -0
- data/test/nodes/array_test.rb +141 -0
- data/test/nodes/assignment_test.rb +49 -0
- data/test/nodes/block_test.rb +125 -0
- data/test/nodes/call_test.rb +229 -0
- data/test/nodes/case_test.rb +68 -0
- data/test/nodes/comments_test.rb +25 -0
- data/test/nodes/const_test.rb +46 -0
- data/test/nodes/conversions_test.rb +9 -0
- data/test/nodes/for_test.rb +34 -0
- data/test/nodes/hash_test.rb +71 -0
- data/test/nodes/heredoc_test.rb +202 -0
- data/test/nodes/identifier_test.rb +51 -0
- data/test/nodes/if_test.rb +100 -0
- data/test/nodes/literals_test.rb +63 -0
- data/test/nodes/method_test.rb +92 -0
- data/test/nodes/namespaces_test.rb +65 -0
- data/test/nodes/node_test.rb +74 -0
- data/test/nodes/nodes_test.rb +23 -0
- data/test/nodes/operator_test.rb +241 -0
- data/test/nodes/separators_test.rb +97 -0
- data/test/nodes/statements_test.rb +70 -0
- data/test/nodes/string_test.rb +92 -0
- data/test/nodes/symbol_test.rb +57 -0
- data/test/nodes/unless_test.rb +42 -0
- data/test/nodes/until_test.rb +61 -0
- data/test/nodes/while_test.rb +71 -0
- data/test/test_helper.rb +51 -0
- data/test/traversal_test.rb +53 -0
- metadata +163 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
# require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
# require 'highlighters/ansi'
|
3
|
+
#
|
4
|
+
# class ContextTest < Test::Unit::TestCase
|
5
|
+
# def setup
|
6
|
+
# Ruby.context_width = 2
|
7
|
+
# end
|
8
|
+
#
|
9
|
+
# def build(code)
|
10
|
+
# Ripper::RubyBuilder.build(code)
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# def lines(range)
|
14
|
+
# range.to_a.map { |i| " call_#{i}(:a)" }.join("\n")
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
# define_method :"test context returns 5 lines" do
|
18
|
+
# program = build(lines(1..10))
|
19
|
+
# line = program.statements.select { |s| s.to_ruby == 'call_4(:a)' }[0]
|
20
|
+
# assert_equal lines(2..6), line.context
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# define_method :"test context returns 3 lines when no preceeding lines present" do
|
24
|
+
# program = build(lines(1..10))
|
25
|
+
# line = program.statements.select { |s| s.to_ruby == 'call_1(:a)' }[0]
|
26
|
+
# assert_equal lines(1..3), line.context
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# define_method :"test context returns 4 lines when only one preceeding line present" do
|
30
|
+
# program = build(lines(1..10))
|
31
|
+
# line = program.statements.select { |s| s.to_ruby == 'call_2(:a)' }[0]
|
32
|
+
# assert_equal lines(1..4), line.context
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# define_method :"test context returns 4 lines when only one succeeding line present" do
|
36
|
+
# program = build(lines(1..10))
|
37
|
+
# line = program.statements.select { |s| s.to_ruby == 'call_9(:a)' }[0]
|
38
|
+
# assert_equal lines(7..10), line.context
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# define_method :"test context returns 3 lines when no succeeding lines present" do
|
42
|
+
# program = build(lines(1..10))
|
43
|
+
# line = program.statements.select { |s| s.to_ruby == 'call_10(:a)' }[0]
|
44
|
+
# assert_equal lines(8..10), line.context
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# define_method :"test context highlights elements" do
|
48
|
+
# program = build(lines(1..10))
|
49
|
+
# highlighter = Highlighters::Ansi.new(:red, :bold)
|
50
|
+
# line = program.statements.select { |s| s.to_ruby == 'call_4(:a)' }[0]
|
51
|
+
# assert_equal " \e[0;31;1mcall_4(:a)\e[0m", line.context(:highlight => highlighter, :width => 0)
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
require 'erb/stripper'
|
4
|
+
|
5
|
+
class ErbStripperTest < Test::Unit::TestCase
|
6
|
+
def test_sexp_filename
|
7
|
+
erb = File.read("#{File.dirname(__FILE__)}/fixtures/template.html.erb")
|
8
|
+
ruby = Erb::Stripper.new.to_ruby(erb)
|
9
|
+
expected = <<-src
|
10
|
+
f.field_set do
|
11
|
+
column do
|
12
|
+
[:foo].each do |foo|
|
13
|
+
t(:erb_1)
|
14
|
+
end
|
15
|
+
t(:erb_2)
|
16
|
+
t(:'foo.erb_3')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
src
|
20
|
+
assert_equal erb.length, ruby.length
|
21
|
+
%w([:foo] erb_1 erb_2 foo.erb_3).each do |token|
|
22
|
+
assert_not_nil ruby.index(token)
|
23
|
+
assert_equal erb.index(token), ruby.index(token)
|
24
|
+
end
|
25
|
+
expected.split("\n").each do |token|
|
26
|
+
assert_not_nil ruby.index(token)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# occurences of \n will be replaced with actual newlines
|
2
|
+
|
3
|
+
# literals
|
4
|
+
1
|
5
|
+
1.1
|
6
|
+
nil
|
7
|
+
true
|
8
|
+
false
|
9
|
+
|
10
|
+
# symbols
|
11
|
+
:a
|
12
|
+
:"a"
|
13
|
+
:"a \n b \n c"
|
14
|
+
:'a'
|
15
|
+
:'a \n b \n c'
|
16
|
+
|
17
|
+
# strings
|
18
|
+
"a"
|
19
|
+
'a'
|
20
|
+
%(a)
|
21
|
+
%( a \n b \n c )
|
22
|
+
%|a|
|
23
|
+
%.a.
|
24
|
+
`ls -a`
|
25
|
+
%x(ls -a)
|
26
|
+
|
27
|
+
|
28
|
+
# arrays
|
29
|
+
[:a,:b,:c]
|
30
|
+
[:a,:b, :c]
|
31
|
+
[:a, :b,:c]
|
32
|
+
[:a, :b, :c]
|
33
|
+
[:a, :b, :c ]
|
34
|
+
[ :a, :b, :c]
|
35
|
+
[ :a, :b, :c ]
|
36
|
+
|
37
|
+
[ \n :a, \n :b, \n :c \n ]
|
38
|
+
|
39
|
+
%w(a b c)
|
40
|
+
%w(a b c )
|
41
|
+
%w( a b c)
|
42
|
+
%w( a b c )
|
43
|
+
|
44
|
+
# hashes
|
45
|
+
{:a=>:a}
|
46
|
+
{:a=>:a }
|
47
|
+
{ :a=>:a}
|
48
|
+
{:a => :a}
|
49
|
+
{ :a=>:a }
|
50
|
+
{:a=> :a }
|
51
|
+
{ :a =>:a}
|
52
|
+
{ :a => :a }
|
53
|
+
|
54
|
+
{ \n :a => \n :a \n }
|
55
|
+
|
56
|
+
# constants
|
57
|
+
I18n
|
58
|
+
class A; end
|
59
|
+
class A; def foo(a, *b, &c); d; end; end
|
60
|
+
module B; end
|
61
|
+
module B; def foo(a, *b, &c); d; end; end
|
62
|
+
|
63
|
+
# assignments
|
64
|
+
a=b
|
65
|
+
a,b=c
|
66
|
+
a, b=c
|
67
|
+
a, b=c,d
|
68
|
+
a, b=c, d
|
69
|
+
a, b=*c
|
70
|
+
|
71
|
+
a = b
|
72
|
+
a,b = c
|
73
|
+
a, b = c
|
74
|
+
a, b = c,d
|
75
|
+
a, b = c, d
|
76
|
+
a, b = *c
|
77
|
+
|
78
|
+
a, b = c, d
|
79
|
+
a, \n b = \n c, \n d
|
80
|
+
|
81
|
+
# operators
|
82
|
+
!a
|
83
|
+
# ...
|
84
|
+
|
85
|
+
# calls
|
86
|
+
t
|
87
|
+
t()
|
88
|
+
t(:a)
|
89
|
+
t :a
|
90
|
+
t :a
|
91
|
+
|
92
|
+
I18n.t
|
93
|
+
I18n.t()
|
94
|
+
I18n.t(:a)
|
95
|
+
|
96
|
+
t(:a,:b)
|
97
|
+
t(:a, :b)
|
98
|
+
t(:a ,:b)
|
99
|
+
t(:a, :b )
|
100
|
+
t(:a ,:b )
|
101
|
+
t( :a, :b)
|
102
|
+
t( :a ,:b)
|
103
|
+
t( :a, :b )
|
104
|
+
t( :a ,:b )
|
105
|
+
|
106
|
+
t(:a, :b,&c)
|
107
|
+
t(:a, :b, &c)
|
108
|
+
|
109
|
+
t(:a, :b, :c => :c, &c)
|
110
|
+
t(:a, :b, { :c => :c }, &c)
|
111
|
+
|
112
|
+
t( \n:a, \n :b, \n :c => \n :c, \n &d)
|
113
|
+
|
114
|
+
a = lambda { |b| c }
|
115
|
+
a &lambda { |b| c }
|
116
|
+
|
117
|
+
# control structures
|
118
|
+
if true then :a else :b end
|
119
|
+
if true; nil else; a end
|
120
|
+
if true\n nil else\n a end
|
121
|
+
a if true
|
122
|
+
|
123
|
+
unless true then false end
|
124
|
+
unless true; false end
|
125
|
+
unless true\n false end
|
126
|
+
nil unless true
|
127
|
+
|
128
|
+
case a; when A, B, C; true; when D; false; else; nil end
|
129
|
+
case a\n when A, B, C\n true\n when D\n false\nelse\n nil end
|
130
|
+
|
131
|
+
begin ; end
|
132
|
+
while true; foo; end
|
133
|
+
begin; foo; end while true
|
134
|
+
foo while true
|
135
|
+
until true; foo; end
|
136
|
+
begin; foo; end until true
|
137
|
+
foo until true
|
138
|
+
|
139
|
+
# special
|
140
|
+
defined?(A)
|
141
|
+
return
|
142
|
+
return 1
|
143
|
+
return(1)
|
144
|
+
break
|
145
|
+
next
|
146
|
+
redo
|
147
|
+
retry
|
148
|
+
|
149
|
+
|
150
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
t(:bar_2)
|
@@ -0,0 +1,371 @@
|
|
1
|
+
# from rubylexer tests
|
2
|
+
|
3
|
+
print ',rekcah ybuR rehtona tsuJ'.reverse
|
4
|
+
|
5
|
+
print %q/92G5S="!A;F]T:&5R(%)U8GD@:&%C:V5R+```/.unpack('u')
|
6
|
+
|
7
|
+
print %q/SnVzdCBhbm90aGVyIFJ1YnkgaGFja2VyLA==/.unpack('m')
|
8
|
+
|
9
|
+
print 'Whfg nabgure Ehol unpxre,'.tr('A-Za-z', 'N-ZA-Mn-za-m')
|
10
|
+
|
11
|
+
print({'ruby' => 'Just another Ruby hacker,'}['ruby'])
|
12
|
+
|
13
|
+
print 'jUsT aNoThEr '.capitalize, 'RuBy HaCkEr,'.capitalize
|
14
|
+
|
15
|
+
print ['Just another Ruby hacker,'][0]
|
16
|
+
|
17
|
+
print ['hacker,', 'Ruby ', 'another ', 'Just '].reverse
|
18
|
+
|
19
|
+
proc {print 'Just another Ruby hacker,'}.call
|
20
|
+
|
21
|
+
def pri() print 'Just another Ruby hacker,' end; pri
|
22
|
+
|
23
|
+
for i in 'Just another Ruby hacker,' do print i end
|
24
|
+
|
25
|
+
print `echo -n Just another Ruby hacker,`
|
26
|
+
|
27
|
+
print 'Just another Ruby hacker,'.split('')
|
28
|
+
|
29
|
+
print 'JQust aQnotQher RQuby hQackQer,'.delete('Q')
|
30
|
+
|
31
|
+
'Just another Ruby hacker,'.scan(/(.)/) {print $1}
|
32
|
+
|
33
|
+
print 'Just ' + 'another ' + 'Ruby ' + 'hacker,'
|
34
|
+
|
35
|
+
print ['4a75737420616e6f746865722052756279206861636b65722c'].pack('H*')
|
36
|
+
|
37
|
+
print 'Just another Ruby hacker,'.split(/(.)/)
|
38
|
+
|
39
|
+
print %w(Just another Ruby hacker,).join(' ')
|
40
|
+
|
41
|
+
print({'another '=>'Just ', 'hacker,'=>'Ruby '}.invert.sort)
|
42
|
+
|
43
|
+
print eval(%-eval %: %|Just another Ruby hacker,| :-)
|
44
|
+
|
45
|
+
#;eval %qPprint eval %-eval %:'Just another Ruby hacker,' :-P
|
46
|
+
|
47
|
+
print Hash.new('Just another Ruby hacker,')[:Ruby]
|
48
|
+
|
49
|
+
print ['Just ', ['another ', ['Ruby ', ['hacker,']]]].flatten
|
50
|
+
|
51
|
+
print Struct.new(*%w|Ruby Just another Ruby hacker,|)[*[0]*4].members.join(' ')
|
52
|
+
|
53
|
+
print Time.now.strftime('Just another Ruby hacker,')
|
54
|
+
|
55
|
+
print " Just another Ruby hacker, \r\n".strip
|
56
|
+
|
57
|
+
print ['Just ', nil, 'another ', nil, 'Ruby ', nil, 'hacker,'].compact
|
58
|
+
|
59
|
+
['hacker,', 'Ruby ', 'another ', 'Just '].reverse_each do |x| print x end
|
60
|
+
|
61
|
+
/Just another Ruby hacker,/.source.display
|
62
|
+
|
63
|
+
send :print, 'Just another Ruby hacker,'
|
64
|
+
|
65
|
+
print ['Just ', 'another ', 'Ruby '] | ['another ', 'Ruby ', 'hacker,']
|
66
|
+
|
67
|
+
print ['Just ', 'another ', 'Perl', 'Ruby ', 'hacker,'] - ['Perl']
|
68
|
+
|
69
|
+
print [['', 'Just another Ruby hacker,']].assoc('')
|
70
|
+
|
71
|
+
print ['Just another Ruby hacker,'].pack('a*')
|
72
|
+
|
73
|
+
print 'Just another Ruby hacker,'.unpack('a*')
|
74
|
+
|
75
|
+
print [['Just another Ruby hacker,'].pop].sort.shift
|
76
|
+
|
77
|
+
print [['Just another Ruby hacker,', '']].rassoc('')
|
78
|
+
|
79
|
+
{'Just another ' => 'Ruby hacker,'}.to_a.display
|
80
|
+
|
81
|
+
print 'Just another Ruby hackeq,'.succ
|
82
|
+
|
83
|
+
print 'jUST ANOTHER rUBY HACKER,'.swapcase
|
84
|
+
|
85
|
+
print ['Just another Ruby hacker,'].find {|x| x}
|
86
|
+
|
87
|
+
print %w(Just another Ruby hacker,).find_all {|x| x}.join(' ')
|
88
|
+
|
89
|
+
print %w(Just another Ruby hacker,).grep(/./).join(' ')
|
90
|
+
|
91
|
+
Ruby = 'Just another Ruby hacker,' and print Object.const_get(:Ruby)
|
92
|
+
|
93
|
+
Proc.new {print 'Just another Ruby hacker,'}[]
|
94
|
+
|
95
|
+
print 'JJuusstt aannootthheerr RRuubbyy hhaacckkeerr,,'.squeeze
|
96
|
+
|
97
|
+
print [1249211252, 543256175, 1952998770, 542274914, 2032167009, 1667982706].pack('N*'), ','
|
98
|
+
|
99
|
+
$> << 'Just ' << 'another ' << 'Ruby ' << 'hacker,'
|
100
|
+
|
101
|
+
5.times do|i|'Jaebcunrykso ettRhr hua,'.scan(/.{5}/) do print $&[i,1] end end
|
102
|
+
|
103
|
+
a=',rekcah ybuR rehtona tsuJ'.split('');print a.pop while not a.empty?
|
104
|
+
|
105
|
+
print ',Pr-eok,c"a$h! kypbquuRA %roeqhbtaoon;ab rtesbujJ&'.gsub(/(.)./, '\1').reverse
|
106
|
+
|
107
|
+
print /.*/.match('Just another Ruby hacker,')
|
108
|
+
|
109
|
+
print $& if /.*/ === 'Just another Ruby hacker,'
|
110
|
+
|
111
|
+
case 'Just another Ruby hacker,' when /.*/; print $~[0] end
|
112
|
+
|
113
|
+
print Marshal.load(Marshal.dump("Just another Ruby hacker,"))
|
114
|
+
|
115
|
+
'Just another Ruby hacker,'.each_byte do |x| print x.chr end
|
116
|
+
|
117
|
+
print '/hacker,/another /Ruby /Just '.split('/').sort.values_at(1,3,2,4)
|
118
|
+
|
119
|
+
print 'Just another Perl hacker,'.sub('Perl', 'Ruby')
|
120
|
+
|
121
|
+
#$><<'RbyckJust another,'.split('').values_at(5..16,9,0,6,1,2,9,14,10,3,4,15..17)
|
122
|
+
|
123
|
+
('a'..'y').to_a.join.tr('a-y','Just another Ruby hacker,').display
|
124
|
+
|
125
|
+
begin print 'Just another ' ensure print 'Ruby hacker,' end
|
126
|
+
|
127
|
+
'J,ursetk caanho tyhbeurR Rruebhyt ohnaac ktesru,J'.scan(/.(.)/).reverse.display
|
128
|
+
|
129
|
+
'J,ursetk caanho tyhbeurR Rruebhyt ohnaac ktesru,J'.gsub(/(.)./,'\1').display
|
130
|
+
|
131
|
+
a='J,ursetk caanho tyhbeurR ';0.step(24,2){|i|print a[i,1]};23.step(1,-2){|i|print a[i,1]}
|
132
|
+
|
133
|
+
a='Js nte uyhce,rka bRrhoatu'.split('');12.times{print a.shift,a.pop};print a
|
134
|
+
|
135
|
+
a='Js nte uyhce,rka bRrhoatu';begin a.sub!(/^(.)(.*)(.)$/){print $1,$3;$2}end while$1;print a
|
136
|
+
|
137
|
+
a='J Ruby hacker,ust another';11.times{a.sub!(/^(.)(.*)(.)$/,'\1\3\2')};print a
|
138
|
+
|
139
|
+
print 'Just. another! -Ruby? $hacker,'.tr_s('-.!?$ ', ' ')
|
140
|
+
|
141
|
+
' e m r,yJaRnafatbpcuekewhjhskvngohrlrxsctdtiubuoyq'.scan(/(.)(.)/).collect!{|x|[x[1],x[0]]}.sort.collect!{|x|x[1]}.display
|
142
|
+
|
143
|
+
'e m r y,aJnRfatapbuckewejhshvkgnholrxrcsdtitbuouqy'.scan(/../).sort.collect!{|x|x[1,1]}.display
|
144
|
+
|
145
|
+
'4a75737420616e6f746865722052756279206861636b65722c'.scan(/../){print $&.hex.chr}
|
146
|
+
|
147
|
+
print ['Just another Perl hacker,'].fill('Just another Ruby hacker,')
|
148
|
+
|
149
|
+
$><<{1=>'Just ',2=>'another ',3=>'Ruby ',4=>'hacker,'}.sort.to_s.delete('1-4')
|
150
|
+
|
151
|
+
Kernel.print %q<Just another Ruby hacker,>
|
152
|
+
|
153
|
+
class Just_another_Ruby_hackerq;end;print Just_another_Ruby_hackerq.to_s.tr('_q',' ,')
|
154
|
+
|
155
|
+
Kust_another_Ruby_hacker=0;print Module.constants.grep(/Kust/)[0].tr('K_','J '), ','
|
156
|
+
|
157
|
+
module Lust_another_Ruby_hackerq; print name.tr('L_q', 'J ,') end
|
158
|
+
|
159
|
+
class Bar; print 'Just another Ruby hacker,' end
|
160
|
+
|
161
|
+
class Baz; def initialize() print 'Just another Ruby hacker,' end end; Baz.new
|
162
|
+
|
163
|
+
eval "A<')I;G0@)TIU<W0@86YO=&AE<B!2=6)Y(&AA8VME<BPG".unpack('u')[0]
|
164
|
+
|
165
|
+
eval "cHJpbnQgJ0p1c3QgYW5vdGhlciBSdWJ5IGhhY2tlciwn".unpack('m')[0]
|
166
|
+
|
167
|
+
$stdout.write 'Just another Ruby hacker,'
|
168
|
+
|
169
|
+
"Just \nanother \nRuby \nhacker,\n".each do |x| print x.chomp end
|
170
|
+
|
171
|
+
print $' if /\n/x === "\nJust another Ruby hacker,"
|
172
|
+
|
173
|
+
raise 'Just another Ruby hacker,' rescue print $!
|
174
|
+
|
175
|
+
print File.basename('~/Just another Ruby hacker,.rb','.*')
|
176
|
+
|
177
|
+
proc{|x|x['Just another Ruby hacker,']}[proc{|x|print x}]
|
178
|
+
|
179
|
+
method(:print)['Just another Ruby hacker,']
|
180
|
+
|
181
|
+
'Just another Ruby hacker,'.method(:display)[]
|
182
|
+
|
183
|
+
print ''.replace('Just another Ruby hacker,')
|
184
|
+
|
185
|
+
instance_eval do print 'Just another Ruby hacker,' end
|
186
|
+
|
187
|
+
Kernel.module_eval do print 'Just another Ruby hacker,' end
|
188
|
+
|
189
|
+
print %%\%s%%%%Just another Ruby hacker,%%%%%%%%%
|
190
|
+
|
191
|
+
print !?????:???%?Just another Ruby hacker,?:??
|
192
|
+
|
193
|
+
#({}.default='Just another Ruby hacker,')[0].display
|
194
|
+
|
195
|
+
print Hash['Just another ', 'Ruby hacker,']
|
196
|
+
|
197
|
+
print 'Just ' 'another ' 'Ruby ' 'hacker,'
|
198
|
+
|
199
|
+
print File.dirname('Just another Ruby hacker,/Just another Ruby porter,')
|
200
|
+
|
201
|
+
def $_.singleton_method_added(*) print 'Just another Ruby hacker,' end
|
202
|
+
|
203
|
+
print ['Just another Ruby hacker,'].delete_at(0)
|
204
|
+
|
205
|
+
print '%s %s %s %s' % %w[Just another Ruby hacker,]
|
206
|
+
|
207
|
+
'cker,by haer RuanothJust '.scan(/.{5}/).reverse.display
|
208
|
+
|
209
|
+
(97..121).to_a.pack('c*').tr('a-y','Just another Ruby hacker,').display
|
210
|
+
|
211
|
+
'abcdefghijklmnopqrstuvwxy'.tr('a-y','Just another Ruby hacker,').display
|
212
|
+
|
213
|
+
',rekcah ybuR rehtona tsuJ'.scan(/.{1}/).reverse.display
|
214
|
+
|
215
|
+
print 'Just another Ruby hacker,'%%; (^_^;;;
|
216
|
+
|
217
|
+
print('Just another Ruby hacker,'% %- ;-)
|
218
|
+
|
219
|
+
'r,keac hbyRur heotant usJ'.scan(/.{1,2}/).reverse.display
|
220
|
+
|
221
|
+
print 'Just another Ruby hacker,' * ('Just another Ruby hacker,' =~ /u/)
|
222
|
+
|
223
|
+
print 'uJtsa onhtreR bu yahkcre,'.unpack('v12c').pack('n12c')
|
224
|
+
|
225
|
+
print 'uJtsa onhtreR bu yahkcre,'.gsub(/(.)(.?)/, '\2\1')
|
226
|
+
|
227
|
+
'uJtsa onhtreR bu yahkcre,'.scan(/(.)(.?)/){|x,y| print y+x}
|
228
|
+
|
229
|
+
print 'Just another Ruby hacker,'['Just another Ruby hacker,']
|
230
|
+
|
231
|
+
print 'Just another Ruby hacker,'[/.*/]
|
232
|
+
|
233
|
+
print [].push('Just ', 'another ', 'Ruby ', 'hacker,')
|
234
|
+
|
235
|
+
print 'Just another Ruby hacker,'[0..-1]
|
236
|
+
|
237
|
+
print 'Just another Ruby hacker,'.instance_eval{self}
|
238
|
+
|
239
|
+
class String; def +@() print self end; +'Just another Ruby hacker,' end
|
240
|
+
|
241
|
+
print '1J2u3s4t5 6a7n8o9t0h1e2r3 4R5u6b7y8 9h0a1c2k3e4r5,'.delete('0-9')
|
242
|
+
|
243
|
+
'Jaubsctd eafngohtihjekrl mRnuobpyq rhsatcukvewrx,y'.gsub(/(.)./, '\1').display
|
244
|
+
|
245
|
+
#$><<{'Just another Ruby hacker,'=>''}.default=0
|
246
|
+
|
247
|
+
print eval('Just another Ruby hacker,'.dump)
|
248
|
+
|
249
|
+
print 'Just another Ruby hacker'.concat(?,)
|
250
|
+
|
251
|
+
print 'Just another Ruby hacker,'.intern.to_s
|
252
|
+
|
253
|
+
print 'Just another Ruby hacker,'.dump[1..-2]
|
254
|
+
|
255
|
+
'Just another Ruby hacker,'.each_line do |x| print x end
|
256
|
+
|
257
|
+
['JUST ANOTHER ', 'RUBY HACKER,'].each do |x| print x.capitalize end
|
258
|
+
|
259
|
+
printf '%.25s', 'Just another Ruby hacker,JARH'
|
260
|
+
|
261
|
+
print 'Just another Ruby hacker,'.split(/Z/)[0]
|
262
|
+
|
263
|
+
print 'Just another Ruby hacker,'.split(//)
|
264
|
+
|
265
|
+
print %w.J u s t \ a n o t h e r \ R u b y \ h a c k e r ,.
|
266
|
+
|
267
|
+
print String([%[Just another Ruby hacker,]])
|
268
|
+
|
269
|
+
print catch(:x){throw :x, 'Just another Ruby hacker,'}
|
270
|
+
|
271
|
+
r,w = IO::pipe;w.print 'Just another Ruby hacker,';w.close;print r.gets
|
272
|
+
|
273
|
+
print sprintf('%s', format('%s' % '%s', 'Just another Ruby hacker,'))
|
274
|
+
|
275
|
+
print eval('Just another Ruby hacker,'.inspect)
|
276
|
+
|
277
|
+
/#{print 'Just another Ruby hacker,'}/
|
278
|
+
|
279
|
+
print 'Just another Ruby hacker,'.scan(/./).collect{|x|x[0]}.pack('U*')
|
280
|
+
|
281
|
+
print 'Just another Ruby hacker,'.scan(/./).pack('a'*25)
|
282
|
+
|
283
|
+
'Just another Ruby hacker,'.send 'yalpsid'.reverse.intern
|
284
|
+
|
285
|
+
print %w.Just another Ruby Ruby Ruby hacker,..uniq.join(' ')
|
286
|
+
|
287
|
+
{}.fetch(:x){'Just another Ruby hacker,'}.display
|
288
|
+
|
289
|
+
{}.delete(:x){'Just another Ruby hacker,'}.display
|
290
|
+
|
291
|
+
print [:x].map{'Just another Ruby hacker,'}
|
292
|
+
|
293
|
+
{'Ruby hacker,'=>'Just another'}.each{|*x|print x.reverse.join(' ')}
|
294
|
+
|
295
|
+
print [].unshift('Ruby hacker,').unshift('Just another').join(' ')
|
296
|
+
|
297
|
+
{3=>'Ruby ',2=>'another ',4=>'hacker,',1=>'Just '}.values_at(1,2,3,4).display
|
298
|
+
|
299
|
+
print [[0,'Just another Ruby hacker,'],1].first.last
|
300
|
+
|
301
|
+
{''=>'JARH'}.update(''=>'Just another Ruby hacker,').display
|
302
|
+
|
303
|
+
{:JARH => 'Just another Ruby hacker,'}.values.display
|
304
|
+
|
305
|
+
{'Just another Ruby hacker,'=>:JARH}.invert[:JARH].display
|
306
|
+
|
307
|
+
print ['Just another Ruby hacker,'=>:JARH][0].keys
|
308
|
+
|
309
|
+
print [{}].slice(0..0)[0].store('', 'Just another Ruby hacker,')
|
310
|
+
|
311
|
+
print 'Just another Ruby hacker,'.split.join(' ')
|
312
|
+
|
313
|
+
begin print 'Just another Ruby hacker,' end while false
|
314
|
+
|
315
|
+
begin rescue then else print 'Just another Ruby hacker,' end
|
316
|
+
|
317
|
+
print //.match('Just another Ruby hacker,').string
|
318
|
+
|
319
|
+
callcc{print 'Just another Ruby hacker,'}
|
320
|
+
|
321
|
+
Thread.start{print'Just another Ruby hacker,'}.join
|
322
|
+
|
323
|
+
('JARH'..'Just another Ruby hacker,').end.display
|
324
|
+
|
325
|
+
('Just another'..'Ruby hacker,').to_s.tr_s('.', ' ').display
|
326
|
+
|
327
|
+
unless true then else 'Just another Ruby hacker,' end.display
|
328
|
+
|
329
|
+
loop do print 'Just another Ruby hacker,'; break end
|
330
|
+
|
331
|
+
1.times do print 'Just another Ruby hacker,' end
|
332
|
+
|
333
|
+
0.upto(0) do print 'Just another Ruby hacker,' end
|
334
|
+
|
335
|
+
0.downto(0) do print 'Just another Ruby hacker,' end
|
336
|
+
|
337
|
+
print Struct.new('Just_another_Ruby_hacker').to_s.split(':')[2].tr('_',' '),','
|
338
|
+
|
339
|
+
def (x='Just another Ruby hacker,').foo() print self end; x.foo
|
340
|
+
|
341
|
+
begin print 'Just another Ruby hacker,' end until true
|
342
|
+
|
343
|
+
for i in %w[Just\ another\ Ruby\ hacker,] do print i end
|
344
|
+
|
345
|
+
'Just another Ruby hacker,'.each_byte do |x| putc x end
|
346
|
+
|
347
|
+
',rekcah ybuR rehtona tsuJ'.scan(/./).reverse_each do |x| putc x end
|
348
|
+
|
349
|
+
print Regexp.quote('Just another Ruby hacker,').delete('\\')
|
350
|
+
|
351
|
+
print true ? "Just another Ruby hacker," :-P
|
352
|
+
|
353
|
+
print true ? "Just another Ruby hacker," :-D
|
354
|
+
|
355
|
+
print *("Just another Ruby hacker,".."Just another Ruby hacker,").to_a
|
356
|
+
|
357
|
+
print eval(%<%%Just another Ruby hacker,%>)
|
358
|
+
|
359
|
+
print case when true then "Just another Ruby hacker," end
|
360
|
+
|
361
|
+
print %w[Just another Ruby hacker,] * " "
|
362
|
+
|
363
|
+
begin end if print "Just another Ruby hacker,"
|
364
|
+
|
365
|
+
print begin "Just another Ruby hacker," end
|
366
|
+
|
367
|
+
print "Just another Ruby hacker,".center(10000).strip
|
368
|
+
|
369
|
+
print "Just " or print "another " or print "Ruby " or print "hacker,"
|
370
|
+
|
371
|
+
print :"Just another Ruby hacker,"
|