lib/rail_feeds/network_rail/schedule/train_schedule.rb
File train_schedule.rb
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module RailFeeds
module NetworkRail
module Schedule
# rubocop:disable Metrics/ClassLength
# A class for holding information about a particular train
Method to_json
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def to_json(**opts)
{
'JsonScheduleV1' => {
'CIF_bank_holiday_running' => bank_holiday_running,
'CIF_stp_indicator' => stp_indicator_to_cif,
Method from_json
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.from_json(json)
data = ::JSON.parse(json)['JsonScheduleV1']
locations = data.dig('schedule_segment', 'schedule_location')&.map do |location|
location_from_json location
Method basic_to_cif
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def basic_to_cif
format('%-80.80s', [
'BSN',
format('%-6.6s', uid),
format('%-6.6s', start_date&.strftime('%y%m%d')),