Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/radiant/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#symbolizeObject



2
3
4
# File 'lib/radiant/core_ext.rb', line 2

def symbolize
  self.gsub(/[^A-Za-z0-9]+/, "_").gsub(/(^_+|_+$)/, "").underscore.to_sym
end

#to_name(last_part = '') ⇒ Object



6
7
8
# File 'lib/radiant/core_ext.rb', line 6

def to_name(last_part = '')
  self.underscore.gsub('/', ' ').humanize.titlecase.gsub(/\s*#{last_part}$/, '')
end