class String
Public Instance Methods
constantize()
click to toggle source
# File lib/csv_record/helpers.rb, line 24 def constantize split('_').map { |w| w.capitalize }.join end
to_class()
click to toggle source
# File lib/csv_record/helpers.rb, line 28 def to_class Object.const_get constantize.singularize end
underscore()
click to toggle source
# File lib/csv_record/helpers.rb, line 32 def underscore gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end