Class: String

Inherits:
Object show all
Defined in:
lib/ruby_patch/core_ext/string.rb

Instance Method Summary collapse

Instance Method Details

#alphanumericObject



11
12
13
# File 'lib/ruby_patch/core_ext/string.rb', line 11

def alphanumeric()
  self.gsub(/\W/, '_')
end

#quote(q1 = '"', q2 = nil) ⇒ Object



4
5
6
7
8
9
# File 'lib/ruby_patch/core_ext/string.rb', line 4

def quote(q1 = '"', q2 = nil)
  q_left = q1
  q_right = q2 || q1

  "#{q_left}#{self}#{q_right}"
end