Class: String

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

Instance Method Summary collapse

Instance Method Details

#alphanumericObject



9
10
11
# File 'lib/ruby_patch/string.rb', line 9

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

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



2
3
4
5
6
7
# File 'lib/ruby_patch/string.rb', line 2

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

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