Class: Wco::Tag

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
app/models/wco/tag.rb

Constant Summary collapse

BOUNCE =
'bounce'
INBOX =
'inbox'
SPAM =
'spam'
NOT_SPAM =
'not-spam'
TRASH =
'trash'
DONOTSEND =
'donotsend'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.bounceObject



34
35
36
# File 'app/models/wco/tag.rb', line 34

def self.bounce
  find_or_create_by({ slug: BOUNCE })
end

.donotsendObject



59
60
61
# File 'app/models/wco/tag.rb', line 59

def self.donotsend
  find_or_create_by({ slug: DONOTSEND })
end

.inboxObject



39
40
41
# File 'app/models/wco/tag.rb', line 39

def self.inbox
  find_or_create_by({ slug: INBOX })
end

.listObject



66
67
68
# File 'app/models/wco/tag.rb', line 66

def self.list
  [[nil,nil]] + all.order_by( slug: :asc ).map { |p| [ p.slug, p.id ] }
end

.not_spamObject



49
50
51
# File 'app/models/wco/tag.rb', line 49

def self.not_spam
  find_or_create_by({ slug: NOT_SPAM })
end

.spamObject



44
45
46
# File 'app/models/wco/tag.rb', line 44

def self.spam
  find_or_create_by({ slug: SPAM })
end

.trashObject



54
55
56
# File 'app/models/wco/tag.rb', line 54

def self.trash
  find_or_create_by({ slug: TRASH })
end

Instance Method Details

#to_sObject



63
64
65
# File 'app/models/wco/tag.rb', line 63

def to_s
  slug
end