Class: Mbox::Mail::Headers::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/mbox/mail/headers/status.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(read = false, old = false) ⇒ Status

Returns a new instance of Status


31
32
33
34
# File 'lib/mbox/mail/headers/status.rb', line 31

def initialize (read = false, old = false)
	@read = read
	@old  = old
end

Class Method Details

.parse(text) ⇒ Object


23
24
25
26
27
28
29
# File 'lib/mbox/mail/headers/status.rb', line 23

def self.parse (text)
	return text if text.is_a?(self)

	return Status.new unless text && text.is_a?(String)

	Status.new(text.include?('R'), text.include?('O'))
end

Instance Method Details

#old?Boolean

Returns:

  • (Boolean)

37
# File 'lib/mbox/mail/headers/status.rb', line 37

def old?;  @old;  end

#read?Boolean

Returns:

  • (Boolean)

36
# File 'lib/mbox/mail/headers/status.rb', line 36

def read?; @read; end

#to_sObject


41
42
43
# File 'lib/mbox/mail/headers/status.rb', line 41

def to_s
	"#{'R' if read?}#{'O' if old?}"
end

#unread?Boolean

Returns:

  • (Boolean)

39
# File 'lib/mbox/mail/headers/status.rb', line 39

def unread?; !read?; end