class MShealth::Mash
Public Class Methods
new(hash)
click to toggle source
Calls superclass method
# File lib/MShealth/mash.rb, line 5 def initialize(hash) mash = super(hash) convert_time(mash) mash end
Protected Instance Methods
convert_key(key)
click to toggle source
# File lib/MShealth/mash.rb, line 23 def convert_key(key) underscore(key) end
underscore(camel_cased_word)
click to toggle source
# File lib/MShealth/mash.rb, line 27 def underscore(camel_cased_word) word = camel_cased_word.to_s.dup word.gsub!(/::/, '/') word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2') word.gsub!(/([a-z\d])([A-Z])/,'\1_\2') word.tr!("-", "_") word.downcase! word end
Private Instance Methods
convert_time(mash)
click to toggle source
# File lib/MShealth/mash.rb, line 13 def convert_time(mash) dic = ['birthdate','last_successful_sync','day_id'] mash.each do |k,v| if dic.include?(k.to_s) or k.to_s.include?("time") mash[k] = Time.iso8601(v) end end end