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

Version Path
facets-glimmer-3.2.0 lib/core/facets/symbol/variablize.rb
facets-3.1.0 lib/core/facets/symbol/variablize.rb
facets-3.0.0 lib/core/facets/symbol/variablize.rb
facets-2.9.3 lib/core/facets/symbol/variablize.rb
facets-2.9.2 src/core/facets/symbol/variablize.rb
facets-2.9.2 lib/core/facets/symbol/variablize.rb
facets-2.9.1 lib/core/facets/symbol/variablize.rb
facets-2.9.0 lib/core/facets/symbol/variablize.rb
facets-2.9.0.pre.2 lib/core/facets/symbol/variablize.rb
facets-2.9.0.pre.1 lib/core/facets/symbol/variablize.rb