lib/edi4r.rb
# Add either Message objects or MsgGroup objects to an interchange;
# mixing both types raises a TypeError.
Add either Message objects or MsgGroup objects to an interchange;
mixing both types raises a TypeError.
Add either Message objects or MsgGroup objects to an interchange ; mixing both types raises a TypeError .
def add( obj, auto_validate=true )
      err_msg = "Added object must also be a "
      if obj.is_a? Message
        @content = :messages unless @content
        raise TypeError, err_msg+"'Message'" if @content != :messages
      elsif obj.is_a? MsgGroup
        @content = :groups unless @content
        raise TypeError, err_msg+"'MsgGroup'" if @content != :groups
      else
	raise TypeError, "Only Message or MsgGroup allowed here"
      end
      obj.validate if auto_validate
      super( obj )
    end
def add ( obj , auto_validate = true ) err_msg = "Added object must also be a " if obj . is_a? Message @content = :messages unless @content raise TypeError , err_msg + "'Message'" if @content != :messages elsif obj . is_a? MsgGroup @content = :groups unless @content raise TypeError , err_msg + "'MsgGroup'" if @content != :groups else raise TypeError , "Only Message or MsgGroup allowed here" end obj . validate if auto_validate super ( obj ) end
Add either Message objects or MsgGroup objects to an interchange;
mixing both types raises a TypeError.
Add either Message objects or MsgGroup objects to an interchange ; mixing both types raises a TypeError .
obj
auto_validate