module Hyperwallet::Util

Public Class Methods

symbolize_attribute(attr) click to toggle source

creatorKey => :creator_key

# File lib/hyperwallet/util.rb, line 4
def self.symbolize_attribute(attr)
  word = attr.to_s.dup
  word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
  word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
  word.tr!("-", "_")
  word.downcase!
  word.to_sym
end