Skip to main content
Edited according to @manatwork's suggestion
Source Link

Ruby 1.x and 2.x, 2320 bytes, score 1210

p defined?([].to_h)?2:to_h&&2rescue 1 

Based on the to_h method which was introduced on the Array class in Ruby 2.

Ruby 1.x and 2.x, 23 bytes, score 12

p defined?([].to_h)?2:1 

Based on the to_h method which was introduced on the Array class in Ruby 2.

Ruby 1.x and 2.x, 20 bytes, score 10

p [].to_h&&2rescue 1 

Based on the to_h method which was introduced on the Array class in Ruby 2.

Source Link

Ruby 1.x and 2.x, 23 bytes, score 12

p defined?([].to_h)?2:1 

Based on the to_h method which was introduced on the Array class in Ruby 2.