mods_display 1.6.2 → 1.6.3

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
  SHA256:
3
- metadata.gz: 6e2d497d858d90fede285e8d03675de0c39802897a8bd2a029a369e420704fc9
4
- data.tar.gz: 89f053e8c0d2e8ad75325fd15319113cbada0c0023079e97f91dcdc65dd3efc8
3
+ metadata.gz: bb30184d2c6b81caa114445a1dbb6f06ef18c413c35c2b6737d02cf383c5aa76
4
+ data.tar.gz: 9c3414483586142a98cd9a350e7a4300959c4cd7c9a2f00e42e43f93362c335a
5
5
  SHA512:
6
- metadata.gz: 8900b21680099143212fcd369df69e5321a4ae8e85b1de1708408d5a97e4fd469d4cb5ea8489debf0cc516a44baadccdedabeacd6446bc5f6d95164289bb7501
7
- data.tar.gz: e5a85a9ead273ff102873f55424e5499138b8260ac1c1d3cd0cb0c3e55cf431ed564be1a686c44ecc37d0a9181903b72f4a080f067df893748f093888e2af83e
6
+ metadata.gz: c259bff4aae3d28754646b78b24fa2e3a2fd94039fb9184767a9a644fec3e013a6400129263424887e77752244465ee0502f65c7a960e74fb0b4223d0df8d224
7
+ data.tar.gz: 9661658df503d9dbe555de30a3a72d081add769a0c11ca6e7908ff2df47f30e8911bc8ffeb75abb41a58f7d8f2c3c10ead31b2de7335dd989a453aa1f151c17e
data/.rubocop.yml CHANGED
@@ -1,16 +1,20 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
- require: rubocop-rspec
3
+ require:
4
+ - rubocop-rspec
5
+ - rubocop-rspec_rails
6
+ - rubocop-capybara
4
7
 
5
8
  AllCops:
6
9
  Exclude:
7
- - '*.gemspec'
8
- - 'bin/**/*'
9
- - 'db/**/*'
10
- - 'spec/fixtures/**/*'
11
- - 'vendor/**/*'
10
+ - "*.gemspec"
11
+ - "bin/**/*"
12
+ - "db/**/*"
13
+ - "spec/fixtures/**/*"
14
+ - "vendor/**/*"
12
15
  TargetRubyVersion: 2.7
13
16
  NewCops: enable
17
+ SuggestExtensions: false
14
18
 
15
19
  # Use single-quoted strings where possible
16
20
  Style/StringLiterals:
@@ -35,4 +39,4 @@ Naming/MethodName:
35
39
  Enabled: false
36
40
 
37
41
  Naming/VariableName:
38
- Enabled: false
42
+ Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -9,18 +9,18 @@
9
9
  # Offense count: 2
10
10
  Capybara/SpecificMatcher:
11
11
  Exclude:
12
- - 'spec/helpers/record_helper_spec.rb'
12
+ - "spec/helpers/record_helper_spec.rb"
13
13
 
14
14
  # Offense count: 2
15
15
  # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
16
16
  Lint/DuplicateBranch:
17
17
  Exclude:
18
- - 'lib/mods_display/fields/title.rb'
18
+ - "lib/mods_display/fields/title.rb"
19
19
 
20
20
  # Offense count: 1
21
21
  Lint/ShadowingOuterLocalVariable:
22
22
  Exclude:
23
- - 'spec/helpers/record_helper_spec.rb'
23
+ - "spec/helpers/record_helper_spec.rb"
24
24
 
25
25
  # Offense count: 15
26
26
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
@@ -36,7 +36,7 @@ Metrics/ClassLength:
36
36
  # Configuration parameters: LengthThreshold.
37
37
  Metrics/CollectionLiteralLength:
38
38
  Exclude:
39
- - 'lib/mods_display/relator_codes.rb'
39
+ - "lib/mods_display/relator_codes.rb"
40
40
 
41
41
  # Offense count: 9
42
42
  # Configuration parameters: AllowedMethods, AllowedPatterns.
@@ -62,31 +62,31 @@ RSpec/BeforeAfterAll:
62
62
  # Prefixes: when, with, without
63
63
  RSpec/ContextWording:
64
64
  Exclude:
65
- - 'spec/fields/contents_spec.rb'
66
- - 'spec/fields/form_spec.rb'
65
+ - "spec/fields/contents_spec.rb"
66
+ - "spec/fields/form_spec.rb"
67
67
 
68
68
  # Offense count: 1
69
69
  # Configuration parameters: IgnoredMetadata.
70
70
  RSpec/DescribeClass:
71
71
  Exclude:
72
- - '**/spec/features/**/*'
73
- - '**/spec/requests/**/*'
74
- - '**/spec/routing/**/*'
75
- - '**/spec/system/**/*'
76
- - '**/spec/views/**/*'
77
- - 'spec/integration/html_spec.rb'
72
+ - "**/spec/features/**/*"
73
+ - "**/spec/requests/**/*"
74
+ - "**/spec/routing/**/*"
75
+ - "**/spec/system/**/*"
76
+ - "**/spec/views/**/*"
77
+ - "spec/integration/html_spec.rb"
78
78
 
79
79
  # Offense count: 1
80
80
  # This cop supports safe autocorrection (--autocorrect).
81
81
  RSpec/ExpectActual:
82
82
  Exclude:
83
- - '**/spec/routing/**/*'
84
- - 'spec/fields/name_spec.rb'
83
+ - "**/spec/routing/**/*"
84
+ - "spec/fields/name_spec.rb"
85
85
 
86
86
  # Offense count: 39
87
87
  # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
88
88
  # Include: **/*_spec*rb*, **/spec/**/*
89
- RSpec/FilePath:
89
+ RSpec/SpecFilePathSuffix:
90
90
  Enabled: false
91
91
 
92
92
  # Offense count: 96
@@ -97,8 +97,8 @@ RSpec/InstanceVariable:
97
97
  # Offense count: 2
98
98
  RSpec/IteratedExpectation:
99
99
  Exclude:
100
- - 'spec/helpers/record_helper_spec.rb'
101
- - 'spec/integration/html_spec.rb'
100
+ - "spec/helpers/record_helper_spec.rb"
101
+ - "spec/integration/html_spec.rb"
102
102
 
103
103
  # Offense count: 4
104
104
  # Configuration parameters: .
@@ -119,9 +119,9 @@ RSpec/NestedGroups:
119
119
  # Offense count: 1
120
120
  # This cop supports unsafe autocorrection (--autocorrect-all).
121
121
  # Configuration parameters: Inferences.
122
- RSpec/Rails/InferredSpecType:
122
+ RSpecRails/InferredSpecType:
123
123
  Exclude:
124
- - 'spec/helpers/record_helper_spec.rb'
124
+ - "spec/helpers/record_helper_spec.rb"
125
125
 
126
126
  # Offense count: 39
127
127
  # Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
@@ -133,7 +133,7 @@ RSpec/SpecFilePathFormat:
133
133
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
134
134
  RSpec/VerifiedDoubles:
135
135
  Exclude:
136
- - 'spec/helpers/record_helper_spec.rb'
136
+ - "spec/helpers/record_helper_spec.rb"
137
137
 
138
138
  # Offense count: 50
139
139
  # Configuration parameters: AllowedConstants.
@@ -143,20 +143,20 @@ Style/Documentation:
143
143
  # Offense count: 4
144
144
  Style/MixinUsage:
145
145
  Exclude:
146
- - 'spec/fields/cartographics_spec.rb'
147
- - 'spec/fields/imprint_spec.rb'
148
- - 'spec/fields/name_spec.rb'
149
- - 'spec/fields/subject_spec.rb'
146
+ - "spec/fields/cartographics_spec.rb"
147
+ - "spec/fields/imprint_spec.rb"
148
+ - "spec/fields/name_spec.rb"
149
+ - "spec/fields/subject_spec.rb"
150
150
 
151
151
  # Offense count: 1
152
152
  Style/MultilineBlockChain:
153
153
  Exclude:
154
- - 'lib/mods_display/fields/imprint.rb'
154
+ - "lib/mods_display/fields/imprint.rb"
155
155
 
156
156
  # Offense count: 13
157
157
  Style/OpenStructUse:
158
158
  Exclude:
159
- - 'spec/helpers/record_helper_spec.rb'
159
+ - "spec/helpers/record_helper_spec.rb"
160
160
 
161
161
  # Offense count: 46
162
162
  # This cop supports safe autocorrection (--autocorrect).
data/Gemfile CHANGED
@@ -3,7 +3,9 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gem 'debug'
6
+ gem 'rubocop-capybara', require: false
6
7
  gem 'rubocop-rspec', require: false
8
+ gem 'rubocop-rspec_rails', require: false
7
9
 
8
10
  # Specify your gem's dependencies in mods_display.gemspec
9
11
  gemspec
@@ -5,7 +5,7 @@ module ModsDisplay
5
5
  private
6
6
 
7
7
  def displayLabel(element)
8
- super(element) || I18n.t('mods_display.abstract')
8
+ super || I18n.t('mods_display.abstract')
9
9
  end
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ module ModsDisplay
5
5
  private
6
6
 
7
7
  def displayLabel(element)
8
- super(element) || I18n.t('mods_display.target_audience')
8
+ super || I18n.t('mods_display.target_audience')
9
9
  end
10
10
  end
11
11
  end
@@ -10,7 +10,7 @@ module ModsDisplay
10
10
  next unless subject_element.respond_to?(:cartographics)
11
11
 
12
12
  subject_element.cartographics.each do |field|
13
- scale = field.scale.empty? ? 'Scale not given' : element_text(field.scale)
13
+ scale = field.scale.empty? ? nil : element_text(field.scale)
14
14
  projection = field.projection.empty? ? nil : element_text(field.projection)
15
15
  coordinates = field.coordinates.empty? ? nil : element_text(field.coordinates)
16
16
  post_scale = [projection, coordinates].compact.join(' ') if [projection, coordinates].compact.length.positive?
@@ -26,7 +26,7 @@ module ModsDisplay
26
26
  private
27
27
 
28
28
  def displayLabel(element)
29
- super(element) || I18n.t('mods_display.table_of_contents')
29
+ super || I18n.t('mods_display.table_of_contents')
30
30
  end
31
31
  end
32
32
  end
@@ -17,7 +17,8 @@ module ModsDisplay
17
17
 
18
18
  def type_attribute_value(date)
19
19
  if date.is_a?(Stanford::Mods::Imprint::DateRange)
20
- date.start.value.type || date.stop.value.type
20
+ # Note that a range can be only single ended.
21
+ date.start&.value&.type || date.stop&.value&.type
21
22
  else
22
23
  date.value.type
23
24
  end
@@ -19,7 +19,7 @@ module ModsDisplay
19
19
  end
20
20
 
21
21
  def displayLabel(element)
22
- super(element) || I18n.t('mods_display.genre')
22
+ super || I18n.t('mods_display.genre')
23
23
  end
24
24
  end
25
25
  end
@@ -20,7 +20,7 @@ module ModsDisplay
20
20
  end
21
21
 
22
22
  def to_html(view_context = ApplicationController.renderer)
23
- component = ModsDisplay::FieldComponent.with_collection(fields, value_transformer: ->(value) { value.to_s })
23
+ component = ModsDisplay::FieldComponent.with_collection(fields, value_transformer: lambda(&:to_s))
24
24
 
25
25
  view_context.render component, layout: false
26
26
  end
@@ -17,7 +17,7 @@ module ModsDisplay
17
17
  end
18
18
 
19
19
  def displayLabel(element)
20
- super(element) || I18n.t('mods_display.title')
20
+ super || I18n.t('mods_display.title')
21
21
  end
22
22
 
23
23
  def title_value
@@ -15,7 +15,7 @@ module ModsDisplay
15
15
  private
16
16
 
17
17
  def displayLabel(type_of_resource_element)
18
- super(type_of_resource_element) || I18n.t('mods_display.type_of_resource')
18
+ super || I18n.t('mods_display.type_of_resource')
19
19
  end
20
20
  end
21
21
  end
@@ -52,15 +52,13 @@ module ModsDisplay
52
52
  end
53
53
 
54
54
  def values_from_subjects(element)
55
- return_values = []
56
- selected_subjects(element).each do |child|
57
- return_values << if element_text(child).include?('--')
58
- element_text(child).split('--').map(&:strip)
59
- else
60
- element_text(child)
61
- end
55
+ selected_subjects(element).map do |child|
56
+ if element_text(child).include?('--')
57
+ element_text(child).split('--').map(&:strip)
58
+ else
59
+ element_text(child)
60
+ end
62
61
  end
63
- return_values
64
62
  end
65
63
 
66
64
  def selected_subjects(element = @value)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ModsDisplay
4
- VERSION = '1.6.2'
4
+ VERSION = '1.6.3'
5
5
  end
data/mods_display.gemspec CHANGED
@@ -31,6 +31,6 @@ Gem::Specification.new do |gem|
31
31
  gem.add_development_dependency 'rspec-rails'
32
32
  gem.add_development_dependency 'rubocop'
33
33
  gem.add_development_dependency 'capybara'
34
- gem.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '~> 6.0'
34
+ gem.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '~> 7.0'
35
35
  gem.add_development_dependency 'combustion', '~> 1.3'
36
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mods_display
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jessie Keck
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-11 00:00:00.000000000 Z
11
+ date: 2024-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stanford-mods
@@ -148,14 +148,14 @@ dependencies:
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '6.0'
151
+ version: '7.0'
152
152
  type: :development
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: '6.0'
158
+ version: '7.0'
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: combustion
161
161
  requirement: !ruby/object:Gem::Requirement
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
262
  - !ruby/object:Gem::Version
263
263
  version: '0'
264
264
  requirements: []
265
- rubygems_version: 3.3.7
265
+ rubygems_version: 3.5.15
266
266
  signing_key:
267
267
  specification_version: 4
268
268
  summary: The MODS Display gem allows implementers to configure a customized display