Class: Sieve::Vacation
- Inherits:
-
Object
- Object
- Sieve::Vacation
- Defined in:
- lib/sieve-parser/vacation.rb
Overview
This class contains the attributes of vacation/autoreplay(action)
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#days ⇒ Object
Returns the value of attribute days.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
-
.parse_text(text) ⇒ Vacation
Parse text and return self with params.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Vacation
constructor
New object.
-
#to_s ⇒ string
Return text of vacation action.
Constructor Details
#initialize(params = {}) ⇒ Vacation
New object
13 14 15 16 17 18 |
# File 'lib/sieve-parser/vacation.rb', line 13 def initialize params={} @days = (params[:days] ? params[:days].to_i : 1) @subject = params[:subject] @content = params[:content] @type = "vacation" end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
7 8 9 |
# File 'lib/sieve-parser/vacation.rb', line 7 def content @content end |
#days ⇒ Object
Returns the value of attribute days.
7 8 9 |
# File 'lib/sieve-parser/vacation.rb', line 7 def days @days end |
#subject ⇒ Object
Returns the value of attribute subject.
7 8 9 |
# File 'lib/sieve-parser/vacation.rb', line 7 def subject @subject end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/sieve-parser/vacation.rb', line 7 def type @type end |
Class Method Details
.parse_text(text) ⇒ Vacation
Parse text and return self with params
23 24 25 26 |
# File 'lib/sieve-parser/vacation.rb', line 23 def self.parse_text(text) params = text.scan(/vacation :days (\d+) :subject "(.*)".*\n.*\s*(.*)/)[0] Vacation.new(:days=>params[0],:subject => params[1],:content => params[2]) end |
Instance Method Details
#to_s ⇒ string
Return text of vacation action
30 31 32 33 34 35 36 37 |
# File 'lib/sieve-parser/vacation.rb', line 30 def to_s %Q{vacation :days #{@days} :subject "#{@subject}" :mime text: Content-Type: text/html; #{@content} . ;} end |