module Medic::Types

Constants

TYPE_IDENTIFIERS

Public Instance Methods

object_type(type) click to toggle source
# File lib/medic/types.rb, line 79
def object_type(type)
  return type if type.is_a? HKObjectType
  case type
  when :workout
    HKObjectType.workoutType
  when :sleep_analysis
    HKObjectType.categoryTypeForIdentifier type_identifier(type)
  when :biological_sex, :blood_type, :date_of_birth
    HKObjectType.characteristicTypeForIdentifier type_identifier(type)
  when :blood_pressure, :food
    HKObjectType.correlationTypeForIdentifier type_identifier(type)
  else
    HKObjectType.quantityTypeForIdentifier type_identifier(type)
  end
end
type_identifier(type) click to toggle source
# File lib/medic/types.rb, line 95
def type_identifier(type)
  type.is_a?(Symbol) ? TYPE_IDENTIFIERS[type] : type
end