module Humidifier::Props
Public Class Methods
from(key, spec, substructs = {})
click to toggle source
builds the appropriate prop object from the given spec line
# File lib/humidifier/props.rb, line 183 def from(key, spec, substructs = {}) case spec['Type'] when 'List' then ListProp.new(key, spec, substructs) when 'Map' then MapProp.new(key, spec, substructs) else singular_from(key, spec, substructs) end end
singular_from(key, spec, substructs)
click to toggle source
builds a prop that is not a List or Map type PrimitiveType is one of Boolean, Double, Integer, Json, String, or Timestamp
# File lib/humidifier/props.rb, line 194 def singular_from(key, spec, substructs) primitive = spec['PrimitiveItemType'] || spec['PrimitiveType'] if primitive && !%w[List Map].include?(primitive) primitive = 'Integer' if primitive == 'Long' const_get(:"#{primitive}Prop").new(key, spec) else StructureProp.new(key, spec, substructs) end end