gares 2.0.0.pre.dev1 → 2.0.0.pre.dev2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f7c0edc0aa26c82ab4329c7dd5b1792f2a8ec35
4
- data.tar.gz: 30b366ac7cbb25cdea86468c4f840603ff886394
3
+ metadata.gz: 5a2068a77f7242decc42538c4b351e9f7310ae98
4
+ data.tar.gz: 75bea0e0b426c6bc6a690d15277b1c97dbb34e9f
5
5
  SHA512:
6
- metadata.gz: 46efb1303a4f1412865d25696a5b96a50fa5bcb7d6ee402854b37a5b8a973aaf32130a453aed2e75d4d831de1580f83f115f6a27196abc3fb688526e9fd18ad2
7
- data.tar.gz: 12dbb18c2b33ab517f49e54e4062f0d8c54dd4809ca4014b892a4a4cc016168d3de216e87427d6a2bf6f5e4f3886d23179e47b55dfa72a807f4e780e36602a19
6
+ metadata.gz: b9b23cdf24b6cf1c8479f677ebc209f16247fb4842d7cb4c992c6198e809cbda2729c791397e200b065d4136c42d985299b08f1ace78e4543ec54aebcc6724a8
7
+ data.tar.gz: 2222356832680a874edfaa2708ee832ecb6d3c04392a0262d55d4c0797e30827aca3639cf9c51209379079b336c1f1341c2f6409a2c833c08479de7e73d30ee1
data/lib/gares/search.rb CHANGED
@@ -7,7 +7,7 @@ module Gares
7
7
  GARES_LIST_URL = "https://raw.githubusercontent.com/capitainetrain/stations/master/stations.csv"
8
8
 
9
9
  # List of keywords to ignore while searching
10
- IGNORE_KEYWORDS = ["ST", "GARE", "SNCF"]
10
+ IGNORE_KEYWORDS = ["ST", "SAINT", "GARE", "SNCF"]
11
11
  # Initialize a new Station search with the specified query
12
12
  #
13
13
  # search = Gares::Search.new("Aix")
@@ -33,7 +33,7 @@ module Gares
33
33
  end
34
34
 
35
35
  def result
36
- keywords = @query.split(" ").select { |keyword| !IGNORE_KEYWORDS.include?(keyword.upcase) }
36
+ keywords = @query.split(/[ -]/).select { |keyword| !IGNORE_KEYWORDS.include?(keyword.upcase) }
37
37
  @result ||= data.select do |station|
38
38
  station.send(@by) && station.send(@by).to_ascii =~ /#{keywords.join(".*")}/i
39
39
  end
data/lib/gares/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gares
2
- VERSION = '2.0.0-dev1'
2
+ VERSION = '2.0.0-dev2'
3
3
  end
@@ -74,6 +74,11 @@ describe Gares::Search do
74
74
  @stations = Gares::Station.search('MONTELIMAR GARE SNCF')
75
75
  expect(@stations.first.sncf_id.downcase).to eql('frmtl')
76
76
  end
77
+
78
+ it 'should return the gare sncf_id.downcase correctly' do
79
+ @stations = Gares::Station.search('MONTPELLIER SAINT-ROCH')
80
+ expect(@stations.first.sncf_id.downcase).to eql('frmpl')
81
+ end
77
82
  end
78
83
  end
79
84
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gares
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.dev1
4
+ version: 2.0.0.pre.dev2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Bonaud