Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 0f077e75a5
Fetching contributors…

Cannot retrieve contributors at this time

16 lines (14 sloc) 0.718 kb
unary:
summary: Easy conversion between strings and symbols.
why: "Sometimes, you do not care if you get a ⇧String⇧ or ⇧Symbol⇧ as input - but when analysing it, you often need to choose one format. A concise possibility for this conversion is using the unary operators ⇧String#-@⇧ and ⇧Symbol#+@⇧."
methods:
String#+@: "+'was_string' # => 'was_string'"
String#-@: "-'was_string' # => :was_string"
Symbol#+@: "+:was_symbol # => 'was_symbol'"
Symbol#-@: "-:was_symbol # => :was_symbol"
package: default
info:
- "Inspired by (I've seen the unary + for Symbol somewhere on the net... but cannot remember where...)"
versions:
- 1.9
- 1.8 (⇧+:literal⇧ not possible)
Jump to Line
Something went wrong with that request. Please try again.