forked from kristianmandrup/ripper2ruby
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sven Fuchs
committed
Jun 28, 2009
1 parent
bf321fd
commit cf16ef5
Showing
21 changed files
with
1,562 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
Do not use colons to separate if/unless/when conditions from expressions: | ||
|
||
# e.g. adva_cms, ansuz, cruisecontrol, freemium, merb, paperclip, radiant, | ||
# rbot, rfpdf, rghost, rstomp, shoulda, typus | ||
case true; when TrueClass: true; end | ||
|
||
# ruby 1.8.7 | ||
=> true | ||
|
||
# ruby 1.9.1 | ||
syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n' | ||
|
||
|
||
Do not use instance_variables, constants or hash access as block parameters: | ||
|
||
# e.g. in cruise_control, spree | ||
lambda { |@foo| } | ||
|
||
# ruby 1.8.7 | ||
=> #<Proc:0x00000000@(irb):1> | ||
|
||
# ruby 1.9.1 | ||
formal argument cannot be an instance variable | ||
|
||
# e.g. in cruisecontrol (frozen rails) | ||
lambda { |foo[:bar]| } | ||
|
||
# ruby 1.8.7 | ||
=> #<Proc:0x00000000@(irb):1> | ||
|
||
# ruby 1.9.1 | ||
formal argument cannot be a constant | ||
|
||
# e.g. in cruisecontrol (frozen rails) | ||
lambda { |foo[:bar]| } | ||
|
||
# ruby 1.8.7 | ||
=> #<Proc:0x00000000@(irb):1> | ||
|
||
# ruby 1.9.1 | ||
syntax error, unexpected '[', expecting '|' | ||
|
||
|
||
Do not use ... | ||
|
||
# e.g. in cruisecontrol (frozen rails) | ||
lambda { |(foo, )| } | ||
|
||
# ruby 1.8.7 | ||
=> #<Proc:0x00000000@(irb):1> | ||
|
||
# ruby 1.9.1 | ||
syntax error, unexpected ')' | ||
|
||
|
||
Do not use commas to separate key and value in a Hash: | ||
|
||
# e.g. cosy, streamlined, webrat | ||
{1, 2} | ||
|
||
# ruby 1.8.7 | ||
=> {1 => 2} | ||
|
||
# ruby 1.9.1 | ||
syntax error, unexpected ',', expecting tASSOC | ||
|
||
|
||
Do not put spaces in front of parentheses (method call arguments): | ||
|
||
# e.g. in exception_logger (logged_exceptions_controller.rb:40, logged_exceptions_helper.rb:9) | ||
A.foo (:bar) | ||
syntax error, unexpected ',', expecting ')' | ||
|
||
|
||
Do not put spaces in front of brackets (Hash access): | ||
|
||
# e.g. in ultrasphinx (configure.rb:247) | ||
|
||
entry ['association_name'] | ||
syntax error, unexpected tLBRACK, expecting keyword_do or '{' or '(' | ||
|
||
|
||
Put a space between the operator and number when calculating: | ||
|
||
# e.g. in liquid (htmltags.rb:49, for.rb:104, paginate.rb:61) | ||
a - b -1 | ||
syntax error, unexpected tUMINUS_NUM, expecting keyword_do or '{' or '(' | ||
|
||
# e.g. in prawn (span.rb:36) | ||
a /2.0 | ||
syntax error, unexpected tREGEXP_BEG, expecting keyword_do or '{' or '(' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<html> | ||
<ul> | ||
<% f.field_set do %> | ||
<% column do %> | ||
<%% column do %%> | ||
<% [:foo].each do |foo| %> | ||
<li> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
def _evaluate_condition(condition) | ||
case condition | ||
when Symbol : self.send(condition) | ||
when Proc : self.instance_eval(&condition) | ||
else | ||
raise ArgumentError, | ||
'Filter condtions need to be either a Symbol or a Proc' | ||
end | ||
end | ||
|
||
|
||
add_tests("call_unary_neg", | ||
"Ruby" => "-2**31", | ||
"RawParseTree" => [:call, | ||
[:call, [:lit, 2], :**, [:array, [:lit, 31]]], | ||
:-@], | ||
"ParseTree" => s(:call, | ||
s(:call, | ||
s(:lit, 2), | ||
:**, | ||
s(:arglist, s(:lit, 31))), | ||
:-@, s(:arglist)), | ||
"Ruby2Ruby" => "-(2 ** 31)") |
Oops, something went wrong.