bolognese 0.9.55 → 0.9.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8483d1f8e557767fec495dcfaf83da4d2bfcd750
4
- data.tar.gz: 8a05b19f4d418fcfa3b771d0e0b2e69de4b3a3a3
3
+ metadata.gz: 1022c2ebb6dac109eff056a0ebec7717a590af87
4
+ data.tar.gz: 92f75fd535284fea56aa0d1b28ed63444c9c9ce7
5
5
  SHA512:
6
- metadata.gz: eb28085d5f306cf6b0774477380c147f7ef700049df2a49d153b2e613130e0a2d96ffce55f27e224e9f44356bf2ae8ba5372f610b204720da6c71499bb74959e
7
- data.tar.gz: ef141c6d4ac0709ef609937d44680e763a21a7b49ba53cbfdfc10eb28610edf4bbffe4b4d8c91dbb0726eac0453a7ed5642cf0efbc822ee76f8dcfe1d9ce1e64
6
+ metadata.gz: 9fe97b6eb3be9a18a3b87877713a9573a422971a9f92b97006cf57f5ca7db7663fabb760f0237f4cb249a6e3277bddfd748f192341a0b370e340c84c0af8663d
7
+ data.tar.gz: cd915315950204de4bbc5737c1476f361cda398907f5a29943e54c158239f3a6529cda8ac848257577a57dfefe095203c6d92fa79562c7aaddf5868d29c334c7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (0.9.55)
4
+ bolognese (0.9.56)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -55,14 +55,15 @@ GEM
55
55
  faraday (>= 0.7.4, < 1.0)
56
56
  gender_detector (0.1.2)
57
57
  unicode_utils (>= 1.3.0)
58
- haml (5.0.3)
58
+ haml (5.0.4)
59
59
  temple (>= 0.8.0)
60
60
  tilt
61
61
  hamster (3.0.0)
62
62
  concurrent-ruby (~> 1.0)
63
63
  hashdiff (0.3.7)
64
64
  htmlentities (4.3.4)
65
- i18n (0.8.6)
65
+ i18n (0.9.0)
66
+ concurrent-ruby (~> 1.0)
66
67
  json (2.1.0)
67
68
  json-ld (2.1.7)
68
69
  multi_json (~> 1.12)
@@ -76,7 +77,7 @@ GEM
76
77
  loofah (2.1.1)
77
78
  crass (~> 1.0.2)
78
79
  nokogiri (>= 1.5.9)
79
- maremma (3.5.11)
80
+ maremma (3.6)
80
81
  activesupport (>= 4.2.5, < 6)
81
82
  addressable (>= 2.3.6)
82
83
  builder (~> 3.2, >= 3.2.2)
@@ -125,19 +126,19 @@ GEM
125
126
  rdf (~> 2.2)
126
127
  rdf-xsd (2.2.0)
127
128
  rdf (~> 2.1)
128
- rspec (3.6.0)
129
- rspec-core (~> 3.6.0)
130
- rspec-expectations (~> 3.6.0)
131
- rspec-mocks (~> 3.6.0)
132
- rspec-core (3.6.0)
133
- rspec-support (~> 3.6.0)
134
- rspec-expectations (3.6.0)
129
+ rspec (3.7.0)
130
+ rspec-core (~> 3.7.0)
131
+ rspec-expectations (~> 3.7.0)
132
+ rspec-mocks (~> 3.7.0)
133
+ rspec-core (3.7.0)
134
+ rspec-support (~> 3.7.0)
135
+ rspec-expectations (3.7.0)
135
136
  diff-lcs (>= 1.2.0, < 2.0)
136
- rspec-support (~> 3.6.0)
137
- rspec-mocks (3.6.0)
137
+ rspec-support (~> 3.7.0)
138
+ rspec-mocks (3.7.0)
138
139
  diff-lcs (>= 1.2.0, < 2.0)
139
- rspec-support (~> 3.6.0)
140
- rspec-support (3.6.0)
140
+ rspec-support (~> 3.7.0)
141
+ rspec-support (3.7.0)
141
142
  rspec-xsd (0.1.0)
142
143
  nokogiri (~> 1.6)
143
144
  rspec (~> 3)
@@ -2,6 +2,10 @@ require 'namae'
2
2
 
3
3
  module Bolognese
4
4
  module AuthorUtils
5
+ # include BenchmarkMethods
6
+ #
7
+ # benchmark :get_authors
8
+
5
9
  IDENTIFIER_SCHEME_URIS = {
6
10
  "ORCID" => "http://orcid.org/"
7
11
  }
@@ -82,10 +86,17 @@ module Bolognese
82
86
  author.fetch("familyName", "").present? ||
83
87
  (author.fetch("name", "").include?(",") &&
84
88
  author.fetch("name", "").exclude?(";")) ||
85
- name_detector.name_exists?(author.fetch("name", "").split(" ").first)
89
+ name_exists?(author.fetch("name", "").split(" ").first)
86
90
  false
87
91
  end
88
92
 
93
+ # recognize given name if we have loaded ::NameDetector data, e.g. in a Rails initializer
94
+ def name_exists?(name)
95
+ return false unless name_detector.present?
96
+
97
+ name_detector.name_exists?(name)
98
+ end
99
+
89
100
  # parse array of author strings into CSL format
90
101
  def get_authors(authors)
91
102
  Array.wrap(authors).map { |author| get_one_author(author) }.unwrap
@@ -351,7 +351,7 @@ module Bolognese
351
351
 
352
352
  # recognize given name. Can be loaded once as ::NameDetector, e.g. in a Rails initializer
353
353
  def name_detector
354
- @name_detector ||= defined?(::NameDetector) ? ::NameDetector : GenderDetector.new
354
+ @name_detector ||= defined?(::NameDetector) ? ::NameDetector : nil
355
355
  end
356
356
 
357
357
  def publication_year
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "0.9.55"
2
+ VERSION = "0.9.56"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -25,6 +25,10 @@ RSpec.configure do |config|
25
25
  config.before do
26
26
  ARGV.replace []
27
27
  end
28
+
29
+ config.before(:suite) do
30
+ ::NameDetector = GenderDetector.new
31
+ end
28
32
  end
29
33
 
30
34
  def fixture_path
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.55
4
+ version: 0.9.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-09 00:00:00.000000000 Z
11
+ date: 2017-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -871,7 +871,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
871
871
  version: '0'
872
872
  requirements: []
873
873
  rubyforge_project:
874
- rubygems_version: 2.6.13
874
+ rubygems_version: 2.6.14
875
875
  signing_key:
876
876
  specification_version: 4
877
877
  summary: Ruby client library for conversion of DOI Metadata