lib/mms2r/media.rb
def number
      unless @number
        params = config['number']
        if params && params.any? && (header = mail.header[params[0]])
          @number = header.to_s.gsub(params[1], params[2])
        end
        if @number.nil? || @number.blank?
          @number = mail.from.first.split(/@|\//).first rescue ""
        end
      end

      @number
    end
def number
      unless @number
        params = config['number']
        if params && params.any? && (header = mail.header[params[0]])
          @number = header.to_s.gsub(params[1], params[2])
        end
        if @number.nil? || @number.blank?
          @number = mail.from.first.split(/@|\//).first rescue ""
        end
      end

      @number
    end
def number unless @number params = config [ 'number' ] if params && params . any? && ( header = mail . header [ params [ 0 ] ] ) @number = header . to_s . gsub ( params [ 1 ] , params [ 2 ] ) end if @number . nil? || @number . blank? @number = mail . from . first . split ( / \/ / ) . first rescue "" end end @number end
Initialize a new MMS2R::Media comprised of a mail.

 Specify options to initialize with:
 :logger => some_logger for logging
 :process => :lazy, for non-greedy processing upon initialization

 #process will have to be called explicitly if the lazy process option
 is chosen.

 Get the phone number associated with this MMS if it exists.  The value
 returned is simplistic, it is just the user name of the from address
 before the @ symbol.  Validation of the number is left to you.  Most
 carriers are using the real phone number as the username.
Initialize a new MMS2R :: Media comprised of a mail .