Class: SpreeCmCommissioner::Transit::TripStopForm
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::Transit::TripStopForm
- Defined in:
- lib/spree_cm_commissioner/transit/trip_stop_form.rb
Instance Attribute Summary collapse
-
#allow_boarding ⇒ Object
Returns the value of attribute allow_boarding.
-
#allow_booking ⇒ Object
Returns the value of attribute allow_booking.
-
#allow_drop_off ⇒ Object
Returns the value of attribute allow_drop_off.
-
#allow_seat_selection ⇒ Object
Returns the value of attribute allow_seat_selection.
-
#board_to_trip_id ⇒ Object
Returns the value of attribute board_to_trip_id.
-
#departure_time ⇒ Object
Returns the value of attribute departure_time.
-
#duration_in_hours ⇒ Object
Returns the value of attribute duration_in_hours.
-
#location_id ⇒ Object
Returns the value of attribute location_id.
-
#route_type ⇒ Object
Returns the value of attribute route_type.
-
#sequence ⇒ Object
Returns the value of attribute sequence.
-
#stop_id ⇒ Object
Returns the value of attribute stop_id.
-
#stop_type ⇒ Object
Returns the value of attribute stop_type.
-
#vehicle_id ⇒ Object
Returns the value of attribute vehicle_id.
-
#vehicle_type_id ⇒ Object
Returns the value of attribute vehicle_type_id.
-
#vendor_id ⇒ Object
Returns the value of attribute vendor_id.
Instance Method Summary collapse
- #allow_boarding? ⇒ Boolean
- #allow_booking? ⇒ Boolean
- #allow_drop_off? ⇒ Boolean
- #allow_seat_selection? ⇒ Boolean
- #booking_editable? ⇒ Boolean
- #branch? ⇒ Boolean
- #duration_in_minutes ⇒ Object
-
#initialize(options = {}) ⇒ TripStopForm
constructor
A new instance of TripStopForm.
- #stop? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ TripStopForm
Returns a new instance of TripStopForm.
53 54 55 56 57 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 53 def initialize( = {}) .each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#allow_boarding ⇒ Object
Returns the value of attribute allow_boarding.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def allow_boarding @allow_boarding end |
#allow_booking ⇒ Object
Returns the value of attribute allow_booking.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def allow_booking @allow_booking end |
#allow_drop_off ⇒ Object
Returns the value of attribute allow_drop_off.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def allow_drop_off @allow_drop_off end |
#allow_seat_selection ⇒ Object
Returns the value of attribute allow_seat_selection.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def allow_seat_selection @allow_seat_selection end |
#board_to_trip_id ⇒ Object
Returns the value of attribute board_to_trip_id.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def board_to_trip_id @board_to_trip_id end |
#departure_time ⇒ Object
Returns the value of attribute departure_time.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def departure_time @departure_time end |
#duration_in_hours ⇒ Object
Returns the value of attribute duration_in_hours.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def duration_in_hours @duration_in_hours end |
#location_id ⇒ Object
Returns the value of attribute location_id.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def location_id @location_id end |
#route_type ⇒ Object
Returns the value of attribute route_type.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def route_type @route_type end |
#sequence ⇒ Object
Returns the value of attribute sequence.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def sequence @sequence end |
#stop_id ⇒ Object
Returns the value of attribute stop_id.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def stop_id @stop_id end |
#stop_type ⇒ Object
Returns the value of attribute stop_type.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def stop_type @stop_type end |
#vehicle_id ⇒ Object
Returns the value of attribute vehicle_id.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def vehicle_id @vehicle_id end |
#vehicle_type_id ⇒ Object
Returns the value of attribute vehicle_type_id.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def vehicle_type_id @vehicle_type_id end |
#vendor_id ⇒ Object
Returns the value of attribute vendor_id.
3 4 5 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 3 def vendor_id @vendor_id end |
Instance Method Details
#allow_boarding? ⇒ Boolean
59 60 61 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 59 def allow_boarding? ActiveModel::Type::Boolean.new.cast(allow_boarding) end |
#allow_booking? ⇒ Boolean
71 72 73 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 71 def allow_booking? ActiveModel::Type::Boolean.new.cast(allow_booking) end |
#allow_drop_off? ⇒ Boolean
63 64 65 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 63 def allow_drop_off? ActiveModel::Type::Boolean.new.cast(allow_drop_off) end |
#allow_seat_selection? ⇒ Boolean
67 68 69 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 67 def allow_seat_selection? ActiveModel::Type::Boolean.new.cast(allow_seat_selection) end |
#booking_editable? ⇒ Boolean
83 84 85 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 83 def booking_editable? branch? && board_to_trip_id.blank? end |
#branch? ⇒ Boolean
75 76 77 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 75 def branch? stop_type == 'branch' || stop_type == :branch end |
#duration_in_minutes ⇒ Object
87 88 89 90 91 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 87 def duration_in_minutes return nil if duration_in_hours.blank? (duration_in_hours.to_f * 60).round end |
#stop? ⇒ Boolean
79 80 81 |
# File 'lib/spree_cm_commissioner/transit/trip_stop_form.rb', line 79 def stop? stop_type == 'stop' || stop_type == :stop end |