Sha256: 1f3c1e5a681e768baeab999d08b4043bc9a240011eb8373d56bde2958868142b
Contents?: true
Size: 280 Bytes
Versions: 10
Compression:
Stored size: 280 Bytes
Contents
class Symbol # Prepend an "@" to the beginning of a symbol to make a instance # variable name. This also replaces non-valid characters with underscores. # # :a.variablize #=> :"@a" # def variablize name = to_s.gsub(/\W/, '_') "@#{name}".to_sym end end
Version data entries
10 entries across 9 versions & 2 rubygems