Class: SpreeCmCommissioner::Transit::ServiceCalendarForm
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::Transit::ServiceCalendarForm
- Includes:
- ActiveModel::Model
- Defined in:
- lib/spree_cm_commissioner/transit/service_calendar_form.rb
Instance Attribute Summary collapse
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#exception_rules ⇒ Object
Returns the value of attribute exception_rules.
-
#friday ⇒ Object
Returns the value of attribute friday.
-
#monday ⇒ Object
Returns the value of attribute monday.
-
#name ⇒ Object
Returns the value of attribute name.
-
#saturday ⇒ Object
Returns the value of attribute saturday.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#sunday ⇒ Object
Returns the value of attribute sunday.
-
#thursday ⇒ Object
Returns the value of attribute thursday.
-
#tuesday ⇒ Object
Returns the value of attribute tuesday.
-
#wednesday ⇒ Object
Returns the value of attribute wednesday.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ ServiceCalendarForm
constructor
A new instance of ServiceCalendarForm.
- #weekdays ⇒ Object
- #weekdays=(hash) ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ ServiceCalendarForm
Returns a new instance of ServiceCalendarForm.
20 21 22 23 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 20 def initialize(attrs = {}) super @exception_rules ||= [] end |
Instance Attribute Details
#end_date ⇒ Object
Returns the value of attribute end_date.
8 9 10 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 8 def end_date @end_date end |
#exception_rules ⇒ Object
Returns the value of attribute exception_rules.
8 9 10 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 8 def exception_rules @exception_rules end |
#friday ⇒ Object
Returns the value of attribute friday.
8 9 10 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 8 def friday @friday end |
#monday ⇒ Object
Returns the value of attribute monday.
8 9 10 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 8 def monday @monday end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 8 def name @name end |
#saturday ⇒ Object
Returns the value of attribute saturday.
8 9 10 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 8 def saturday @saturday end |
#start_date ⇒ Object
Returns the value of attribute start_date.
8 9 10 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 8 def start_date @start_date end |
#sunday ⇒ Object
Returns the value of attribute sunday.
8 9 10 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 8 def sunday @sunday end |
#thursday ⇒ Object
Returns the value of attribute thursday.
8 9 10 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 8 def thursday @thursday end |
#tuesday ⇒ Object
Returns the value of attribute tuesday.
8 9 10 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 8 def tuesday @tuesday end |
#wednesday ⇒ Object
Returns the value of attribute wednesday.
8 9 10 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 8 def wednesday @wednesday end |
Instance Method Details
#weekdays ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 25 def weekdays { 'monday' => monday, 'tuesday' => tuesday, 'wednesday' => wednesday, 'thursday' => thursday, 'friday' => friday, 'saturday' => saturday, 'sunday' => sunday } end |
#weekdays=(hash) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/spree_cm_commissioner/transit/service_calendar_form.rb', line 37 def weekdays=(hash) hash = hash.transform_keys(&:to_s) @monday = cast_bool(hash['monday']) @tuesday = cast_bool(hash['tuesday']) @wednesday = cast_bool(hash['wednesday']) @thursday = cast_bool(hash['thursday']) @friday = cast_bool(hash['friday']) @saturday = cast_bool(hash['saturday']) @sunday = cast_bool(hash['sunday']) end |