Module: Humidifier::Props
- Defined in:
- lib/humidifier/props.rb
Defined Under Namespace
Classes: BooleanProp, DoubleProp, IntegerProp, JsonProp, ListProp, MapProp, Prop, StringProp, StructureProp, TimestampProp
Class Method Summary collapse
-
.from(key, spec, substructs = {}) ⇒ Object
builds the appropriate prop object from the given spec line.
-
.singular_from(key, spec, substructs) ⇒ Object
builds a prop that is not a List or Map type PrimitiveType is one of Boolean, Double, Integer, Json, String, or Timestamp.
Class Method Details
.from(key, spec, substructs = {}) ⇒ Object
builds the appropriate prop object from the given spec line
183 184 185 186 187 188 189 |
# 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) ⇒ Object
builds a prop that is not a List or Map type PrimitiveType is one of Boolean, Double, Integer, Json, String, or Timestamp
194 195 196 197 198 199 200 201 202 203 |
# 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 |