Permalink
Browse files

Added JRuby-ported %S[] patch.

  • Loading branch information...
1 parent 25ff36f commit b5344793268c7143d98f7816fc82c02e448273f3 Michael Edgar committed Jul 7, 2011
Showing with 22,099 additions and 0 deletions.
  1. +26 −0 jruby/symbol_list_syntax/README.md
  2. +22,073 −0 jruby/symbol_list_syntax/symbol_list_syntax.diff
View
26 jruby/symbol_list_syntax/README.md
@@ -0,0 +1,26 @@
+# Symbol List Syntax
+
+**Author:** Michael Edgar, adapted from Aaron Patterson's patch for CRuby
+**Date:** 7/6/2011
+
+## What it does
+
+This patch adds a simple syntax change to Ruby 1.9's grammar: a syntax for an array of symbols.
+
+Much as you would use the following to create a list of strings:
+
+```
+words = %w(foo bar baz) #=> ['foo', 'bar', 'baz']
+```
+
+With this patch, you can use the following syntax to create a list of symbols:
+
+```
+syms = %S(foo bar baz) #=> [:foo, :bar, :baz]
+```
+
+The delimiter, of course, is up to you:
+
+```
+syms = %S[foo bar] + %S|baz qux| #=> [:foo, :bar, :baz, :qux]
+```
View
22,073 jruby/symbol_list_syntax/symbol_list_syntax.diff
22,073 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

0 comments on commit b534479

Please sign in to comment.