Sha256: 7a0a6ed00be152e283ccdbf2a6f16d8468699f23abbd9ae15852c08635ef8412

Contents?: true

Size: 552 Bytes

Versions: 3

Compression:

Stored size: 552 Bytes

Contents

module ActiveSupport::Inflector

  # Downcases and removes a leading @
  def deinstance_variableize(the_string)
    result = the_string.to_s.dup
    result.downcase.gsub(/^@/, '')
  end
  
  # Adds a @ to the beginning of <tt>the_string</tt> and returns it as a symbol
  def instance_variableize(the_string)
    "@#{the_string}".to_sym
  end
end

class String
  def deinstance_variableize
    ActiveSupport::Inflector.deinstance_variableize(self)
  end
  
  def instance_variableize
    ActiveSupport::Inflector.instance_variableize(self)
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redis_backed_model-1.1.0 lib/redis_backed_model/inflections.rb
redis_backed_model-1.0.1 lib/redis_backed_model/inflections.rb
redis_backed_model-1.0.0 lib/redis_backed_model/inflections.rb