app/controllers/incoming_message_controller.rb
def parse_lists_from_subject(subject)
    # extract part between '[...]'
    subject.to_s.match(/\[(.*)\]/)
    if $1
      # and create array by valid separators: \s , |
      subject_array = $1.split(/[\s,|]/)
    else
      return []
    end
    lists = []
    List.all.each do |list|
      subject_array.each do |pot_list|
        if pot_list.casecmp(list.name) == 0
          lists << list
        end
      end
    end
    return lists
  end
# returns an array of the lists that are recognized in the subject of an email
returns an array of the lists that are recognized in the subject of an email
returns an array of the lists that are recognized in the subject of an email
def parse_lists_from_subject(subject)
    subject.to_s.match(/\[(.*)\]/)
    if $1
      subject_array = $1.split(/[\s,|]/)
    else
      return []
    end
    lists = []
    List.all.each do |list|
      subject_array.each do |pot_list|
        if pot_list.casecmp(list.name) == 0
          lists << list
        end
      end
    end
    return lists
  end
def parse_lists_from_subject ( subject ) subject . to_s . match ( / \[ (.*) \] / ) if $1 subject_array = $1 . split ( / [ \s ,|] / ) else return [ ] end lists = [ ] List . all . each do | list | subject_array . each do | pot_list | if pot_list . casecmp ( list . name ) == 0 lists << list end end end return lists end
returns an array of the lists that are recognized in the subject of an email
returns an array of the lists that are recognized in the subject of an email
# extract part between '[...]' # and create array by valid separators: \s , |
subject