module Blender::Utils::Refinements
Public Instance Methods
camelcase(string)
click to toggle source
# File lib/blender/utils/refinements.rb, line 20 def camelcase(string) str = string.dup str.gsub!(/[^A-Za-z0-9_]/, '_') rname = nil regexp = %r{^(.+?)(_(.+))?$} mn = str.match(regexp) if mn rname = mn[1].capitalize while mn && mn[3] mn = mn[3].match(regexp) rname << mn[1].capitalize if mn end end rname end
symbolize(hash)
click to toggle source
# File lib/blender/utils/refinements.rb, line 36 def symbolize(hash) res = {} hash.keys.each do |k| res[k.to_sym] = hash[k] end res end