Sha256: 0a54aafd5b63623d1a53786e43a00834f48d1b0e0d1d53223fe0166a24ebeafe

Contents?: true

Size: 569 Bytes

Versions: 4

Compression:

Stored size: 569 Bytes

Contents

module Carrier
  class Message < ActiveRecord::Base
    
    class << self
      def re name
        if name.match(/re/).nil?
          return "re: "+name
        elsif !name.match(/re:/).nil?
          return name.sub(/re:/,'re[2]:')
        elsif name.match(/re\[\d+\]/)
          re_count = name.match(/re\[\d+\]:/)[0].match(/\d+/)[0]
          re_count = re_count.to_i + 1
          return name.sub(/re\[\d+\]/, 're['+re_count.to_s+']')
        end
        name
      end
    end

    def subject_without_re
      subject.gsub(/re\[\d+\]: /,'')
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
carrier-0.1.2 app/models/carrier/message/subject.rb
carrier-0.1.1 app/models/carrier/message/subject.rb
carrier-0.1.0 app/models/carrier/message/subject.rb
carrier-0.0.6 app/models/carrier/message/subject.rb