Sha256: df6f0b4ac805005ce7775f4b7208b143a51c6e231a3ca6f07653a2af5513a7ad

Contents?: true

Size: 228 Bytes

Versions: 22

Compression:

Stored size: 228 Bytes

Contents

class String

  # Prepend an "@" to the beginning of a string
  # to make a instance variable name. This also replaces
  # non-valid characters with underscores.

  def variablize
    v = gsub(/\W/, '_')
    "@#{v}"
  end

end

Version data entries

22 entries across 21 versions & 3 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/string/variablize.rb
facets-3.1.0 lib/core/facets/string/variablize.rb
facets-3.0.0 lib/core/facets/string/variablize.rb
facets-2.9.3 lib/core/facets/string/variablize.rb
facets-2.9.2 lib/core/facets/string/variablize.rb
facets-2.9.2 src/core/facets/string/variablize.rb
facets-2.9.1 lib/core/facets/string/variablize.rb
facets-2.9.0 lib/core/facets/string/variablize.rb
facets-2.9.0.pre.2 lib/core/facets/string/variablize.rb
facets-2.9.0.pre.1 lib/core/facets/string/variablize.rb
facets-2.8.4 lib/core/facets/string/variablize.rb
facets-2.8.3 lib/core/facets/string/variablize.rb
facets-2.8.2 lib/core/facets/string/variablize.rb
facets-2.8.1 lib/core/facets/string/variablize.rb
facets-2.8.0 lib/core/facets/string/variablize.rb
facets-2.7.0 lib/core/facets/string/variablize.rb
facets-2.6.0 lib/core/facets/string/variablize.rb
facets-2.5.0 lib/core/facets/string/variablize.rb
facets-2.5.1 lib/core/facets/string/variablize.rb
facets-2.4.5 lib/core/facets/string/variablize.rb