class Gillbus::GetTripSeats::Response
Constants
- SEGMENT_REGEX
Public Instance Methods
segments(val)
click to toggle source
# File lib/gillbus/get_trip_seats.rb, line 52 def segments(val) return {} unless val.present? max_segment_number = val.keys.max.match(SEGMENT_REGEX)[:number].to_i [*0..max_segment_number].each_with_object({}) do |segment, hash| seats = val["SEGMENT_#{segment}_SEAT"].to_a hash[segment] = seats.map { |seat| Seat.parse(seat) }.presence || [] end end