From 0b19848a0e34c0bf764bd6eaa33865b06700ea80 Mon Sep 17 00:00:00 2001 From: Martin Sidaway Date: Sun, 12 Aug 2018 21:40:17 +0100 Subject: [PATCH 1/3] lib/atco.rb: Look up method by code --- lib/atco.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/atco.rb b/lib/atco.rb index 62b6560..dcec975 100644 --- a/lib/atco.rb +++ b/lib/atco.rb @@ -38,7 +38,7 @@ def parse(file) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, unparsed = [] data.each_with_index do |line, line_number| # rubocop:disable Metrics/BlockLength - if line == data.first + if line_number.zero? header = parse_header(line) next end @@ -52,13 +52,13 @@ def parse(file) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, object = send("parse_#{method}", line) next unless object[:record_identity] && object[:record_identity] == identifier - current_journey = object if object[:record_identity] && object[:record_identity] == METHODS[:journey_header] - if object[:record_identity] && (object[:record_identity] == METHODS[:location] || object[:record_identity] == METHODS[:additional_location_info]) # rubocop:disable Layout/LineLength - if object[:record_identity] == METHODS[:location] - current_location = object - else - locations << Location.new(current_location, object) - end + case method + when :journey_header + current_journey = object + when :location + current_location = object + when :additional_location_info + locations << Location.new(current_location, object) end if current_journey @@ -73,6 +73,7 @@ def parse(file) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, unparsed << { line: line, line_number: line_number } next end + objects << object end { header: header, locations: locations, journeys: journeys, unparsed: unparsed } end From e46ff33b7f7ed473a269ce0db37a3fadb5d2f59a Mon Sep 17 00:00:00 2001 From: David Rice Date: Tue, 2 Apr 2024 19:03:44 +0100 Subject: [PATCH 2/3] fix: rebase conflicts --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f703189..ec6ca6d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ pkg/* checksums/* *.gem spec/artefacts/test.json -.rspec_status \ No newline at end of file +.rspec_status From 999d4b870294f11ee171456aebe27ac4c86d60ed Mon Sep 17 00:00:00 2001 From: David Rice Date: Fri, 12 Apr 2024 11:59:19 +0100 Subject: [PATCH 3/3] release: bump version 1.0.6 --- CONTRIBUTORS.md | 1 + Gemfile.lock | 2 +- lib/atco/version.rb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 8eaa30c..44e75a4 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -2,3 +2,4 @@ * David Rice [@davidjrice](https://github.com/davidjrice) * Thomas Buckley-Houston [@tombh](https://github.com/tombh) +* Martin Sidaway [@martinjos](https://github.com/martinjos) \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 2e98d87..4e9b849 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - atco (1.0.5) + atco (1.0.6) GEM remote: https://rubygems.org/ diff --git a/lib/atco/version.rb b/lib/atco/version.rb index f20b359..8d2ee61 100644 --- a/lib/atco/version.rb +++ b/lib/atco/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Atco - VERSION = "1.0.5" + VERSION = "1.0.6" end