Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
README.md
symbol_list_syntax.diff

README.md

Symbol List Syntax

Author: Aaron Patterson

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]
Something went wrong with that request. Please try again.