Class: Hiccup::Schedule
- Inherits:
-
Object
- Object
- Hiccup::Schedule
- Extended by:
- Hiccup
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/hiccup/schedule.rb
Constant Summary
Constants included from Hiccup
Instance Attribute Summary collapse
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#ends ⇒ Object
Returns the value of attribute ends.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#monthly_pattern ⇒ Object
Returns the value of attribute monthly_pattern.
-
#skip ⇒ Object
Returns the value of attribute skip.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#weekly_pattern ⇒ Object
Returns the value of attribute weekly_pattern.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Schedule
constructor
A new instance of Schedule.
- #to_hash ⇒ Object
Methods included from Hiccup
Constructor Details
#initialize(options = {}) ⇒ Schedule
Returns a new instance of Schedule.
18 19 20 21 22 23 24 25 26 |
# File 'lib/hiccup/schedule.rb', line 18 def initialize(={}) @kind =([:kind] || :never).to_sym @start_date =([:start_date] || Date.today).to_date @ends = .key?(:ends) ? [:ends] : false @end_date = [:end_date] ? [:end_date].to_date : nil @skip =([:skip] || [:interval] || 1).to_i @weekly_pattern = [:weekly_pattern] || [] @monthly_pattern = [:monthly_pattern] || [] end |
Instance Attribute Details
#end_date ⇒ Object
Returns the value of attribute end_date.
29 30 31 |
# File 'lib/hiccup/schedule.rb', line 29 def end_date @end_date end |
#ends ⇒ Object
Returns the value of attribute ends.
29 30 31 |
# File 'lib/hiccup/schedule.rb', line 29 def ends @ends end |
#kind ⇒ Object
Returns the value of attribute kind.
29 30 31 |
# File 'lib/hiccup/schedule.rb', line 29 def kind @kind end |
#monthly_pattern ⇒ Object
Returns the value of attribute monthly_pattern.
29 30 31 |
# File 'lib/hiccup/schedule.rb', line 29 def monthly_pattern @monthly_pattern end |
#skip ⇒ Object
Returns the value of attribute skip.
29 30 31 |
# File 'lib/hiccup/schedule.rb', line 29 def skip @skip end |
#start_date ⇒ Object
Returns the value of attribute start_date.
29 30 31 |
# File 'lib/hiccup/schedule.rb', line 29 def start_date @start_date end |
#weekly_pattern ⇒ Object
Returns the value of attribute weekly_pattern.
29 30 31 |
# File 'lib/hiccup/schedule.rb', line 29 def weekly_pattern @weekly_pattern end |
Instance Method Details
#to_hash ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/hiccup/schedule.rb', line 32 def to_hash { :kind => kind, :start_date => start_date, :ends => ends, :end_date => end_date, :weekly_pattern => weekly_pattern, :monthly_pattern => monthly_pattern } end |