Module: ASpaceExport::ExportModelHelpers
- Defined in:
- backend/app/exporters/lib/export_helpers.rb
Instance Method Summary collapse
-
#extract_date_string(date) ⇒ Object
-
#extract_note_content(note) ⇒ Object
-
#get_subnotes_by_type(obj, note_type) ⇒ Object
Instance Method Details
#extract_date_string(date) ⇒ Object
214 215 216 217 218 219 220 221 222 |
# File 'backend/app/exporters/lib/export_helpers.rb', line 214 def extract_date_string(date) if date['expression'] date['expression'] elsif date['end'].nil? || date['end'] == date['begin'] date['begin'] else "#{date['begin']} - #{date['end']}" end end |
#extract_note_content(note) ⇒ Object
225 226 227 228 229 230 231 |
# File 'backend/app/exporters/lib/export_helpers.rb', line 225 def extract_note_content(note) if note['content'] Array(note['content']).join(" ") else get_subnotes_by_type(note, 'note_text').map {|sn| sn['content']}.join(" ").gsub(/\n +/, "\n") end end |
#get_subnotes_by_type(obj, note_type) ⇒ Object
234 235 236 |
# File 'backend/app/exporters/lib/export_helpers.rb', line 234 def get_subnotes_by_type(obj, note_type) obj['subnotes'].select {|sn| sn['jsonmodel_type'] == note_type} end |