lib/mms2r/media.rb
def process # :yields: media_type, file
      unless @was_processed
        log("#{self.class} processing", :info)

        parts = self.folded_parts(mail)
        parts.each do |part|
          if part.part_type? == 'text/html'
            process_html_part(part)
          else
            process_part(part)
          end
        end

        @was_processed = true
      end

      # when process acts upon a block
      if block_given?
        media.each do |k, v|
          yield(k, v)
        end
      end

    end
def process # :yields: media_type, file
      unless @was_processed
        log("#{self.class} processing", :info)

        parts = self.folded_parts(mail)
        parts.each do |part|
          if part.part_type? == 'text/html'
            process_html_part(part)
          else
            process_part(part)
          end
        end

        @was_processed = true
      end

      # when process acts upon a block
      if block_given?
        media.each do |k, v|
          yield(k, v)
        end
      end

    end
def process # :yields: media_type, file unless @was_processed log ( "#{self.class} processing" , :info ) parts = self . folded_parts ( mail ) parts . each do | part | if part . part_type? == 'text/html' process_html_part ( part ) else process_part ( part ) end end @was_processed = true end # when process acts upon a block if block_given? media . each do | k , v | yield ( k , v ) end end end
process is a template method and collects all the media in a MMS.
 Override helper methods to this template to clean out advertising and/or
 ignore media that are advertising.  This method should not be overridden
 unless there is an extreme special case in processing the media of a MMS
 (like Sprint)

 Helper methods for the process template:
 * ignore_media? -- true if the media contained in a part should be ignored.
 * process_media -- retrieves media to temporary file, returns path to file.
 * transform_text -- called by process_media, strips out advertising.
 * temp_file -- creates a temporary filepath based on information from the part.

 Block support:
 Call process() with a block to automatically iterate through media.
 For example, to process and receive only media of video type:
   mms.process do |media_type, file|
     results << file if media_type =~ /video/
   end

 note: purge must be explicitly called to remove the media files
       mms2r extracts from an mms message.
process is a template method and collects all the media in a MMS . Override helper methods to this template to clean out advertising and / or ignore media that are advertising . This method should not be overridden unless there is an extreme special case in processing the media of a MMS ( like Sprint )