Module: Blender::Utils::Refinements
- Included in:
- Discovery, RSpec, SchedulerDSL
- Defined in:
- lib/blender/utils/refinements.rb
Instance Method Summary collapse
Instance Method Details
#camelcase(string) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 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) ⇒ Object
36 37 38 39 40 41 42 |
# 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 |