Module: Extensions::HL7::Segment::ClassMethods
- Defined in:
- lib/core_ext/segment.rb
Instance Method Summary collapse
Instance Method Details
#from_hash(type, hash) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/core_ext/segment.rb', line 38 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 |