Class: RelatonBib::HashConverter
- Defined in:
- lib/relaton_bib/hash_converter.rb
Class Method Summary collapse
- .abstract_hash_to_bib(ret) ⇒ Object
- .accesslocation_hash_to_bib(ret) ⇒ Object
-
.affiliation_hash_to_bib(person) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength.
- .array(arr) ⇒ Array
- .bib_item(item_hash) ⇒ RelatonBib::BibliographicItem
-
.biblionote_hash_to_bib(ret) ⇒ Object
rubocop:disable Metrics/MethodLength,Metrics/AbcSize.
- .classification_hash_to_bib(ret) ⇒ Object
-
.contacts_hash_to_bib(entity) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength.
-
.contributors_hash_to_bib(ret) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength,Metrics/PerceivedComplexity.
- .copyright_hash_to_bib(ret) ⇒ Object
-
.dates_hash_to_bib(ret) ⇒ Object
rubocop:disable Metrics/AbcSize.
-
.docid_hash_to_bib(ret) ⇒ Object
rubocop:disable Metrics/AbcSize.
- .docstatus_hash_to_bib(ret) ⇒ Object
- .editorialgroup_hash_to_bib(ret) ⇒ Object
-
.extent_hash_to_bib(ret) ⇒ Object
def timestamp_hash(ret) ret ||= Date.today.to_s end.
- .formattedref(frf) ⇒ RelatonBib::FormattedRef
- .formattedref_hash_to_bib(ret) ⇒ Object
-
.fullname_hash_to_bib(person) ⇒ Object
rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity.
- .hash_to_bib(args) ⇒ Hash
- .ics_hash_to_bib(ret) ⇒ Object
- .language_hash_to_bib(ret) ⇒ Object
- .link_hash_to_bib(ret) ⇒ Object
- .locality(loc) ⇒ Object
- .locality_locality_stack(lls) ⇒ Object
- .localizedstring(lst) ⇒ RelatonBib::LocalizedString
- .localname(name, person) ⇒ RelatonBib::LocalizedString
- .medium_hash_to_bib(ret) ⇒ Object
-
.org_hash_to_bib(org) ⇒ Object
rubocop:disable Metrics/AbcSize.
- .parse_validity_time(val, period) ⇒ Object
- .person_hash_to_bib(person) ⇒ Object
- .person_identifiers_hash_to_bib(person) ⇒ Object
- .place_hash_to_bib(ret) ⇒ Object
- .relation_bibitem_hash_to_bib(rel) ⇒ Object
- .relation_locality_hash_to_bib(rel) ⇒ RelatonBib::LocalityStack
- .relation_source_locality_hash_to_bib(rel) ⇒ Object
- .relations_hash_to_bib(ret) ⇒ Object
- .script_hash_to_bib(ret) ⇒ Object
- .series_hash_to_bib(ret) ⇒ Object
- .size_hash_to_bib(ret) ⇒ Object
- .stage(stg) ⇒ RelatonBib::DocumentStatus::Stage
- .structuredidentifier_hash_to_bib(ret) ⇒ Object
- .symbolize(obj) ⇒ Hash, ...
- .title_hash_to_bib(ret) ⇒ Object
- .typed_title_strig(title) ⇒ RelatonBib::TypedTitleString
- .validity_hash_to_bib(ret) ⇒ Object
- .version_hash_to_bib(ret) ⇒ Object
Class Method Details
.abstract_hash_to_bib(ret) ⇒ Object
102 103 104 105 106 107 108 |
# File 'lib/relaton_bib/hash_converter.rb', line 102 def abstract_hash_to_bib(ret) return unless ret[:abstract] ret[:abstract] = array(ret[:abstract]).map do |a| a.is_a?(String) ? FormattedString.new(content: a) : a end end |
.accesslocation_hash_to_bib(ret) ⇒ Object
124 125 126 127 128 |
# File 'lib/relaton_bib/hash_converter.rb', line 124 def accesslocation_hash_to_bib(ret) return unless ret[:accesslocation] ret[:accesslocation] = array(ret[:accesslocation]) end |
.affiliation_hash_to_bib(person) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/relaton_bib/hash_converter.rb', line 259 def affiliation_hash_to_bib(person) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength return [] unless person[:affiliation] array(person[:affiliation]).map do |a| a[:description] = array(a[:description])&.map do |d| cnt = if d.is_a?(Hash) { content: d[:content], language: d[:language], script: d[:script], format: d[:format] } else { content: d } end FormattedString.new(**cnt) end Affiliation.new( organization: Organization.new(**org_hash_to_bib(a[:organization])), description: a[:description], ) end end |
.array(arr) ⇒ Array
472 473 474 475 476 477 |
# File 'lib/relaton_bib/hash_converter.rb', line 472 def array(arr) return [] unless arr return [arr] unless arr.is_a?(Array) arr end |
.bib_item(item_hash) ⇒ RelatonBib::BibliographicItem
330 331 332 |
# File 'lib/relaton_bib/hash_converter.rb', line 330 def bib_item(item_hash) BibliographicItem.new(**item_hash) end |
.biblionote_hash_to_bib(ret) ⇒ Object
rubocop:disable Metrics/MethodLength,Metrics/AbcSize
161 162 163 164 165 166 167 168 169 170 |
# File 'lib/relaton_bib/hash_converter.rb', line 161 def biblionote_hash_to_bib(ret) # rubocop:disable Metrics/MethodLength,Metrics/AbcSize return unless ret[:biblionote] ret[:biblionote] = array(ret[:biblionote]) .reduce(BiblioNoteCollection.new([])) do |mem, n| mem << if n.is_a?(String) then BiblioNote.new content: n else BiblioNote.new(**n) end end end |
.classification_hash_to_bib(ret) ⇒ Object
396 397 398 399 400 401 402 |
# File 'lib/relaton_bib/hash_converter.rb', line 396 def classification_hash_to_bib(ret) if ret[:classification] ret[:classification] = array(ret[:classification]).map do |cls| Classification.new(**cls) end end end |
.contacts_hash_to_bib(entity) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength
278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/relaton_bib/hash_converter.rb', line 278 def contacts_hash_to_bib(entity) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength return [] unless entity[:contact] array(entity[:contact]).map do |a| if a[:city] || a[:country] RelatonBib::Address.new( street: Array(a[:street]), city: a[:city], postcode: a[:postcode], country: a[:country], state: a[:state] ) else RelatonBib::Contact.new(type: a[:type], value: a[:value]) end end end |
.contributors_hash_to_bib(ret) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength,Metrics/PerceivedComplexity
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/relaton_bib/hash_converter.rb', line 194 def contributors_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength,Metrics/PerceivedComplexity return unless ret[:contributor] ret[:contributor] = array(ret[:contributor]) ret[:contributor]&.each_with_index do |c, i| roles = array(ret[:contributor][i][:role]).map do |r| if r.is_a? Hash { type: r[:type], description: array(r[:description]) } # elsif r.is_a? Array # { type: r[0], description: r.fetch(1) } else { type: r } end end ret[:contributor][i][:role] = roles ret[:contributor][i][:entity] = if c[:person] person_hash_to_bib(c[:person]) else org_hash_to_bib(c[:organization]) end ret[:contributor][i].delete(:person) ret[:contributor][i].delete(:organization) end end |
.copyright_hash_to_bib(ret) ⇒ Object
294 295 296 297 298 299 300 301 |
# File 'lib/relaton_bib/hash_converter.rb', line 294 def copyright_hash_to_bib(ret) return unless ret[:copyright] ret[:copyright] = array(ret[:copyright]).map do |c| c[:owner] = array(c[:owner]) c end end |
.dates_hash_to_bib(ret) ⇒ Object
rubocop:disable Metrics/AbcSize
130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/relaton_bib/hash_converter.rb', line 130 def dates_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize return unless ret[:date] ret[:date] = array(ret[:date]) ret[:date].each_with_index do |d, i| # value is synonym of on: it is reserved word in YAML if d[:value] ret[:date][i][:on] ||= d[:value] ret[:date][i].delete(:value) end end end |
.docid_hash_to_bib(ret) ⇒ Object
rubocop:disable Metrics/AbcSize
143 144 145 146 147 148 149 150 151 |
# File 'lib/relaton_bib/hash_converter.rb', line 143 def docid_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize return unless ret[:docid] ret[:docid] = array(ret[:docid]) ret[:docid]&.each_with_index do |id, i| id[:type] ||= id[:id].match(/^\w+(?=\s)/)&.to_s ret[:docid][i] = DocumentIdentifier.new(**id) end end |
.docstatus_hash_to_bib(ret) ⇒ Object
177 178 179 180 181 182 183 |
# File 'lib/relaton_bib/hash_converter.rb', line 177 def docstatus_hash_to_bib(ret) ret[:docstatus] && ret[:docstatus] = DocumentStatus.new( stage: stage(ret[:docstatus][:stage]), substage: stage(ret[:docstatus][:substage]), iteration: ret[:docstatus][:iteration], ) end |
.editorialgroup_hash_to_bib(ret) ⇒ Object
429 430 431 432 433 434 435 436 |
# File 'lib/relaton_bib/hash_converter.rb', line 429 def editorialgroup_hash_to_bib(ret) return unless ret[:editorialgroup] technical_committee = array(ret[:editorialgroup]).map do |wg| TechnicalCommittee.new WorkGroup.new(**wg) end ret[:editorialgroup] = EditorialGroup.new technical_committee end |
.extent_hash_to_bib(ret) ⇒ Object
def timestamp_hash(ret)
ret[:fetched] ||= Date.today.to_s
end
49 50 51 52 53 54 55 56 57 |
# File 'lib/relaton_bib/hash_converter.rb', line 49 def extent_hash_to_bib(ret) return unless ret[:extent] ret[:extent] = array(ret[:extent]).map do |e| locality e # ret[:extent][i] = Locality.new(e[:type], e[:reference_from], # e[:reference_to]) end end |
.formattedref(frf) ⇒ RelatonBib::FormattedRef
506 507 508 509 510 511 512 |
# File 'lib/relaton_bib/hash_converter.rb', line 506 def formattedref(frf) if frf.is_a?(Hash) RelatonBib::FormattedRef.new(**frf) else RelatonBib::FormattedRef.new(content: frf) end end |
.formattedref_hash_to_bib(ret) ⇒ Object
172 173 174 175 |
# File 'lib/relaton_bib/hash_converter.rb', line 172 def formattedref_hash_to_bib(ret) ret[:formattedref] && ret[:formattedref] = formattedref(ret[:formattedref]) end |
.fullname_hash_to_bib(person) ⇒ Object
rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/relaton_bib/hash_converter.rb', line 241 def fullname_hash_to_bib(person) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity n = person[:name] FullName.new( forename: array(n[:forename])&.map { |f| localname(f, person) }, initial: array(n[:initial])&.map { |f| localname(f, person) }, addition: array(n[:addition])&.map { |f| localname(f, person) }, prefix: array(n[:prefix])&.map { |f| localname(f, person) }, surname: localname(n[:surname], person), completename: localname(n[:completename], person), ) end |
.hash_to_bib(args) ⇒ Hash
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/relaton_bib/hash_converter.rb', line 9 def hash_to_bib(args) return nil unless args.is_a?(Hash) ret = Marshal.load(Marshal.dump(symbolize(args))) # deep copy # timestamp_hash(ret) unless nested title_hash_to_bib(ret) link_hash_to_bib(ret) language_hash_to_bib(ret) script_hash_to_bib(ret) dates_hash_to_bib(ret) docid_hash_to_bib(ret) version_hash_to_bib(ret) biblionote_hash_to_bib(ret) abstract_hash_to_bib(ret) formattedref_hash_to_bib(ret) docstatus_hash_to_bib(ret) contributors_hash_to_bib(ret) copyright_hash_to_bib(ret) relations_hash_to_bib(ret) series_hash_to_bib(ret) medium_hash_to_bib(ret) place_hash_to_bib(ret) extent_hash_to_bib(ret) size_hash_to_bib(ret) accesslocation_hash_to_bib(ret) classification_hash_to_bib(ret) validity_hash_to_bib(ret) ret[:keyword] = array(ret[:keyword]) ret[:license] = array(ret[:license]) editorialgroup_hash_to_bib ret ics_hash_to_bib ret structuredidentifier_hash_to_bib ret ret end |
.ics_hash_to_bib(ret) ⇒ Object
439 440 441 442 443 |
# File 'lib/relaton_bib/hash_converter.rb', line 439 def ics_hash_to_bib(ret) return unless ret[:ics] ret[:ics] = array(ret[:ics]).map { |ics| ICS.new(**ics) } end |
.language_hash_to_bib(ret) ⇒ Object
90 91 92 93 94 |
# File 'lib/relaton_bib/hash_converter.rb', line 90 def language_hash_to_bib(ret) return unless ret[:language] ret[:language] = array(ret[:language]) end |
.link_hash_to_bib(ret) ⇒ Object
110 111 112 113 114 |
# File 'lib/relaton_bib/hash_converter.rb', line 110 def link_hash_to_bib(ret) return unless ret[:link] ret[:link] = array(ret[:link]) end |
.locality(loc) ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/relaton_bib/hash_converter.rb', line 59 def locality(loc) if loc[:locality_stack] LocalityStack.new(loc[:locality_stack].map { |l| locality(l) }) else l = loc[:locality] Locality.new(l[:type], l[:reference_from], l[:reference_to]) end end |
.locality_locality_stack(lls) ⇒ Object
342 343 344 345 346 347 348 349 350 351 |
# File 'lib/relaton_bib/hash_converter.rb', line 342 def locality_locality_stack(lls) if lls[:locality_stack] array(lls[:locality_stack]).map do |lc| l = lc[:locality] || lc Locality.new(l[:type], l[:reference_from], l[:reference_to]) end else [Locality.new(lls[:type], lls[:reference_from], lls[:reference_to])] end end |
.localizedstring(lst) ⇒ RelatonBib::LocalizedString
495 496 497 498 499 500 501 502 |
# File 'lib/relaton_bib/hash_converter.rb', line 495 def localizedstring(lst) if lst.is_a?(Hash) RelatonBib::LocalizedString.new(lst[:content], lst[:language], lst[:script]) else RelatonBib::LocalizedString.new(lst) end end |
.localname(name, person) ⇒ RelatonBib::LocalizedString
482 483 484 485 486 487 488 489 490 491 |
# File 'lib/relaton_bib/hash_converter.rb', line 482 def localname(name, person) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize return nil if name.nil? lang = name[:language] if name.is_a?(Hash) lang ||= person[:name][:language] script = name[:script] if name.is_a?(Hash) script ||= person[:name][:script] n = name.is_a?(Hash) ? name[:content] : name RelatonBib::LocalizedString.new(n, lang, script) end |
.medium_hash_to_bib(ret) ⇒ Object
391 392 393 |
# File 'lib/relaton_bib/hash_converter.rb', line 391 def medium_hash_to_bib(ret) ret[:medium] = Medium.new(**ret[:medium]) if ret[:medium] end |
.org_hash_to_bib(org) ⇒ Object
rubocop:disable Metrics/AbcSize
219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/relaton_bib/hash_converter.rb', line 219 def org_hash_to_bib(org) # rubocop:disable Metrics/AbcSize return nil if org.nil? org[:identifier] = array(org[:identifier])&.map do |a| OrgIdentifier.new(a[:type], a[:id]) end org[:subdivision] = array(org[:subdivision]).map do |sd| LocalizedString.new sd end org[:contact] = contacts_hash_to_bib(org) org end |
.parse_validity_time(val, period) ⇒ Object
414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'lib/relaton_bib/hash_converter.rb', line 414 def parse_validity_time(val, period) t = val[period]&.to_s return unless t p = period == :ends ? -1 : 1 case t when /^\d{4}$/ Date.new(t.to_i, p, p).to_time when /^(?<year>\d{4})-(?<month>\d{1,2})$/ Date.new($~[:year].to_i, $~[:month].to_i, p).to_time else Time.parse t end end |
.person_hash_to_bib(person) ⇒ Object
232 233 234 235 236 237 238 239 |
# File 'lib/relaton_bib/hash_converter.rb', line 232 def person_hash_to_bib(person) Person.new( name: fullname_hash_to_bib(person), affiliation: affiliation_hash_to_bib(person), contact: contacts_hash_to_bib(person), identifier: person_identifiers_hash_to_bib(person), ) end |
.person_identifiers_hash_to_bib(person) ⇒ Object
253 254 255 256 257 |
# File 'lib/relaton_bib/hash_converter.rb', line 253 def person_identifiers_hash_to_bib(person) array(person[:identifier])&.map do |a| PersonIdentifier.new(a[:type], a[:id]) end end |
.place_hash_to_bib(ret) ⇒ Object
116 117 118 119 120 121 122 |
# File 'lib/relaton_bib/hash_converter.rb', line 116 def place_hash_to_bib(ret) return unless ret[:place] ret[:place] = array(ret[:place]).map do |pl| pl.is_a?(String) ? Place.new(name: pl) : Place.new(**pl) end end |
.relation_bibitem_hash_to_bib(rel) ⇒ Object
319 320 321 322 323 324 325 326 |
# File 'lib/relaton_bib/hash_converter.rb', line 319 def relation_bibitem_hash_to_bib(rel) if rel[:bibitem] rel[:bibitem] = bib_item hash_to_bib(rel[:bibitem]) else warn "[relaton-bib] bibitem missing: #{rel}" rel[:bibitem] = nil end end |
.relation_locality_hash_to_bib(rel) ⇒ RelatonBib::LocalityStack
336 337 338 339 340 |
# File 'lib/relaton_bib/hash_converter.rb', line 336 def relation_locality_hash_to_bib(rel) rel[:locality] = array(rel[:locality])&.map do |bl| LocalityStack.new locality_locality_stack(bl) end end |
.relation_source_locality_hash_to_bib(rel) ⇒ Object
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/relaton_bib/hash_converter.rb', line 354 def relation_source_locality_hash_to_bib(rel) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength rel[:source_locality] = array(rel[:source_locality])&.map do |sl| sls = if sl[:source_locality_stack] array(sl[:source_locality_stack]).map do |l| SourceLocality.new(l[:type], l[:reference_from], l[:reference_to]) end else l = SourceLocality.new(sl[:type], sl[:reference_from], sl[:reference_to]) [l] end SourceLocalityStack.new sls end end |
.relations_hash_to_bib(ret) ⇒ Object
304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/relaton_bib/hash_converter.rb', line 304 def relations_hash_to_bib(ret) return unless ret[:relation] ret[:relation] = array(ret[:relation]) ret[:relation]&.each do |r| if r[:description] r[:description] = FormattedString.new(**r[:description]) end relation_bibitem_hash_to_bib(r) relation_locality_hash_to_bib(r) relation_source_locality_hash_to_bib(r) end end |
.script_hash_to_bib(ret) ⇒ Object
96 97 98 99 100 |
# File 'lib/relaton_bib/hash_converter.rb', line 96 def script_hash_to_bib(ret) return unless ret[:script] ret[:script] = array(ret[:script]) end |
.series_hash_to_bib(ret) ⇒ Object
371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/relaton_bib/hash_converter.rb', line 371 def series_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity ret[:series] = array(ret[:series])&.map do |s| s[:formattedref] && s[:formattedref] = formattedref(s[:formattedref]) if s[:title] s[:title] = { content: s[:title] } unless s[:title].is_a?(Hash) s[:title] = typed_title_strig(s[:title]) end s[:abbreviation] && s[:abbreviation] = localizedstring(s[:abbreviation]) Series.new(**s) end end |
.size_hash_to_bib(ret) ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'lib/relaton_bib/hash_converter.rb', line 68 def size_hash_to_bib(ret) return unless ret[:size] ret[:size] = array(ret[:size]) size = ret[:size]&.map do |val| BibliographicSize::Value.new(**val) end ret[:size] = BibliographicSize.new(size) end |
.stage(stg) ⇒ RelatonBib::DocumentStatus::Stage
187 188 189 190 191 192 |
# File 'lib/relaton_bib/hash_converter.rb', line 187 def stage(stg) return unless stg args = stg.is_a?(String) ? { value: stg } : stg DocumentStatus::Stage.new(**args) end |
.structuredidentifier_hash_to_bib(ret) ⇒ Object
446 447 448 449 450 451 452 453 454 |
# File 'lib/relaton_bib/hash_converter.rb', line 446 def structuredidentifier_hash_to_bib(ret) return unless ret[:structuredidentifier] sids = array(ret[:structuredidentifier]).map do |si| si[:agency] = array si[:agency] StructuredIdentifier.new(**si) end ret[:structuredidentifier] = StructuredIdentifierCollection.new sids end |
.symbolize(obj) ⇒ Hash, ...
458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/relaton_bib/hash_converter.rb', line 458 def symbolize(obj) case obj when Hash obj.reduce({}) do |memo, (k, v)| memo[k.to_sym] = symbolize(v) memo end when Array then obj.reduce([]) { |memo, v| memo << symbolize(v) } else obj end end |
.title_hash_to_bib(ret) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/relaton_bib/hash_converter.rb', line 78 def title_hash_to_bib(ret) return unless ret[:title] ret[:title] = array(ret[:title]) .reduce(TypedTitleStringCollection.new) do |m, t| if t.is_a?(Hash) then m << t else m + TypedTitleString.from_string(t) end end end |
.typed_title_strig(title) ⇒ RelatonBib::TypedTitleString
386 387 388 |
# File 'lib/relaton_bib/hash_converter.rb', line 386 def typed_title_strig(title) TypedTitleString.new(**title) end |
.validity_hash_to_bib(ret) ⇒ Object
405 406 407 408 409 410 411 412 |
# File 'lib/relaton_bib/hash_converter.rb', line 405 def validity_hash_to_bib(ret) return unless ret[:validity] b = parse_validity_time(ret[:validity], :begins) e = parse_validity_time(ret[:validity], :ends) r = parse_validity_time(ret[:validity], :revision) ret[:validity] = Validity.new(begins: b, ends: e, revision: r) end |
.version_hash_to_bib(ret) ⇒ Object
153 154 155 156 157 158 159 |
# File 'lib/relaton_bib/hash_converter.rb', line 153 def version_hash_to_bib(ret) return unless ret[:version] ret[:version] = array(ret[:version]).map do |v| BibliographicItem::Version.new(v[:revision_date], v[:draft]) end end |