cff 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,40 +12,47 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- #
15
+ ##
16
16
  module CFF
17
17
 
18
- # :stopdoc:
19
- # Utility methods useful throughout the rest of the CFF library.
20
- # This module is not in the public API.
18
+ # Util provides utility methods useful throughout the rest of the CFF library.
19
+ #
20
+ # Util does not provide any methods or fields for the public API.
21
21
  module Util
22
-
23
- def delete_from_hash(hash, *keys)
24
- h = hash.dup
25
- keys.each { |key| h.delete(key) }
26
- h
27
- end
22
+ # :stopdoc:
28
23
 
29
24
  def method_to_field(name)
30
- name.gsub('_', '-')
25
+ name.tr('_', '-')
31
26
  end
32
27
 
33
- def build_actor_collection(field, source)
34
- source.each do |s|
35
- field << (s.has_key?('given-names') ? Person.new(s) : Entity.new(s))
28
+ def build_actor_collection!(source)
29
+ source.map! do |s|
30
+ s.has_key?('given-names') ? Person.new(s) : Entity.new(s)
36
31
  end
37
32
  end
38
33
 
39
- def expand_field(field)
40
- field.fields if field.respond_to?(:fields)
34
+ def normalize_modelpart_array!(array)
35
+ array.select! { |i| i.respond_to?(:fields) }
41
36
  end
42
37
 
43
- def expand_array_field(field)
44
- field.reject do |f|
45
- !f.respond_to?(:fields)
46
- end.map { |f| f.fields }
38
+ def fields_to_hash(fields)
39
+ hash = {}
40
+
41
+ fields.each do |field, value|
42
+ if value.respond_to?(:map)
43
+ unless value.empty?
44
+ hash[field] = value.map do |v|
45
+ v.respond_to?(:fields) ? v.fields : v.to_s
46
+ end
47
+ end
48
+ else
49
+ hash[field] = value.respond_to?(:fields) ? value.fields : value
50
+ end
51
+ end
52
+
53
+ hash
47
54
  end
48
55
 
56
+ # :startdoc:
49
57
  end
50
- # :startdoc:
51
58
  end
@@ -12,9 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- #
15
+ ##
16
16
  module CFF
17
17
  # :nodoc:
18
- VERSION = "0.3.0"
19
- DEFAULT_SPEC_VERSION = "1.0.3"
18
+ VERSION = '0.4.0'.freeze
19
+ DEFAULT_SPEC_VERSION = '1.0.3'.freeze
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Haines
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-11 00:00:00.000000000 Z
11
+ date: 2018-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: language_list
@@ -53,19 +53,19 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.16'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: coveralls
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '0.8'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '0.8'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -81,47 +81,61 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '5.0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: coveralls
84
+ name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.8'
89
+ version: '10.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.8'
96
+ version: '10.0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: test_construct
98
+ name: rdoc
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '2.0'
103
+ version: '6.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '2.0'
110
+ version: '6.0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rdoc
112
+ name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '6.0'
117
+ version: '0.54'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '6.0'
124
+ version: '0.54'
125
+ - !ruby/object:Gem::Dependency
126
+ name: test_construct
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '2.0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '2.0'
125
139
  description: See https://citation-file-format.github.io/ for more info.
126
140
  email:
127
141
  - robert.haines@manchester.ac.uk
@@ -129,11 +143,8 @@ executables: []
129
143
  extensions: []
130
144
  extra_rdoc_files: []
131
145
  files:
132
- - ".gitignore"
133
- - ".ruby-gemset"
134
- - ".ruby-version"
135
- - ".travis.yml"
136
146
  - CHANGES.md
147
+ - CITATION.cff
137
148
  - CODE_OF_CONDUCT.md
138
149
  - Gemfile
139
150
  - LICENCE
@@ -145,8 +156,8 @@ files:
145
156
  - lib/cff.rb
146
157
  - lib/cff/entity.rb
147
158
  - lib/cff/file.rb
148
- - lib/cff/model-part.rb
149
159
  - lib/cff/model.rb
160
+ - lib/cff/model_part.rb
150
161
  - lib/cff/person.rb
151
162
  - lib/cff/reference.rb
152
163
  - lib/cff/util.rb
@@ -171,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
182
  version: '0'
172
183
  requirements: []
173
184
  rubyforge_project:
174
- rubygems_version: 2.6.14
185
+ rubygems_version: 2.7.7
175
186
  signing_key:
176
187
  specification_version: 4
177
188
  summary: A Ruby library for manipulating CITATION.cff files.
data/.gitignore DELETED
@@ -1,30 +0,0 @@
1
- *.gem
2
- *.rbc
3
- /.config
4
- /coverage/
5
- /InstalledFiles
6
- /pkg/
7
- /spec/reports/
8
- /spec/examples.txt
9
- /test/tmp/
10
- /test/version_tmp/
11
- /tmp/
12
-
13
- ## Documentation cache and generated files:
14
- /.yardoc/
15
- /_yardoc/
16
- /doc/
17
- /rdoc/
18
- /html/
19
-
20
- ## Environment normalization:
21
- /.bundle/
22
- /vendor/bundle
23
- /lib/bundler/man/
24
-
25
- # for a library or gem, you might want to ignore these files since the code is
26
- # intended to run in multiple environments; otherwise, check them in:
27
- Gemfile.lock
28
-
29
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
30
- .rvmrc
@@ -1 +0,0 @@
1
- cff
@@ -1 +0,0 @@
1
- ruby-2.4.3
@@ -1,20 +0,0 @@
1
- language: ruby
2
-
3
- sudo: false
4
-
5
- cache: bundler
6
-
7
- rvm:
8
- - 2.2.9
9
- - 2.3.6
10
- - 2.4.3
11
- - 2.5.0
12
- - rbx-3
13
- - ruby-head
14
-
15
- matrix:
16
- allow_failures:
17
- - rvm: rbx-3
18
- - rvm: ruby-head
19
-
20
- before_install: gem install bundler -v 1.16.1