Module: Extensions::HL7::Segment::ClassMethods
- Defined in:
- lib/core_ext/segment.rb
Instance Method Summary collapse
Instance Method Details
#from_hash(type, hash) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/core_ext/segment.rb', line 34 def from_hash(type, hash) clazz = eval("::HL7::Message::Segment::#{type}") instance = clazz.new instance.hash = hash fields = clazz.fields fields.keys.each do |field| instance.send("#{field}=",hash[field.to_s.camelize(:lower)]) end instance end |