Method: Zippo::BinaryStructure::Base::InstanceMethods#convert_to

Defined in:
lib/zippo/binary_structure/base.rb

#convert_to(other) ⇒ Object



94
95
96
97
98
99
100
# File 'lib/zippo/binary_structure/base.rb', line 94

def convert_to other
  other.default.tap do |obj|
    self.class.common_fields_with(other).each do |field|
      obj.instance_variable_set "@#{field}", send(field)
    end
  end
end