Module: SortNameProcessor::Software

Defined in:
backend/app/model/mixins/sort_name_processor.rb

Class Method Summary collapse

Class Method Details

.process(json, extras = {}) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'backend/app/model/mixins/sort_name_processor.rb', line 133

def self.process(json, extras = {})
  result = ""

  result << "#{json["manufacturer"]} " if json["manufacturer"]
  result << "#{json["software_name"]}" if json["software_name"]
  result << " #{json["version"]}" if json["version"]
  result << " (#{json["qualifier"]})" if json["qualifier"]
  result << ", #{json["dates"]}" if json["dates"]

  dates = json['dates'].nil? ? SortNameProcessor::Utils.first_date(extras, 'dates_of_existence') : nil
  result << " (#{dates})" if dates

  result.length > 255 ? result[0..254] : result
end