Class: Record
- Inherits:
-
Object
- Object
- Record
- Includes:
- JsonHelper, ManipulateNode, PrefixHelper, RecordHelper
- Defined in:
- public/app/models/record.rb
Direct Known Subclasses
Accession, AgentCorporateEntity, AgentFamily, AgentPerson, ArchivalObject, Classification, Container, DigitalObject, Resource, ResourceOrderedRecords, Subject
Constant Summary collapse
- ABSTRACT =
%w(abstract scopecontent)
Instance Attribute Summary collapse
-
#agents ⇒ Object
readonly
Returns the value of attribute agents.
-
#classifications ⇒ Object
readonly
Returns the value of attribute classifications.
-
#container_display ⇒ Object
readonly
Returns the value of attribute container_display.
-
#container_summary_for_badge ⇒ Object
readonly
Returns the value of attribute container_summary_for_badge.
-
#container_titles_and_uris ⇒ Object
readonly
Returns the value of attribute container_titles_and_uris.
-
#criteria ⇒ Object
Returns the value of attribute criteria.
-
#dates ⇒ Object
readonly
Returns the value of attribute dates.
-
#display_string ⇒ Object
readonly
Returns the value of attribute display_string.
-
#extents ⇒ Object
readonly
Returns the value of attribute extents.
-
#external_documents ⇒ Object
readonly
Returns the value of attribute external_documents.
-
#full ⇒ Object
readonly
Returns the value of attribute full.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#lang_materials ⇒ Object
readonly
Returns the value of attribute lang_materials.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#linked_digital_objects ⇒ Object
readonly
Returns the value of attribute linked_digital_objects.
-
#notes ⇒ Object
readonly
Returns the value of attribute notes.
-
#other_level ⇒ Object
readonly
Returns the value of attribute other_level.
-
#primary_type ⇒ Object
readonly
Returns the value of attribute primary_type.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#repository_information ⇒ Object
readonly
Returns the value of attribute repository_information.
-
#resolved_repository ⇒ Object
readonly
Returns the value of attribute resolved_repository.
-
#resolved_resource ⇒ Object
readonly
Returns the value of attribute resolved_resource.
-
#resolved_top_container ⇒ Object
readonly
Returns the value of attribute resolved_top_container.
-
#subjects ⇒ Object
readonly
Returns the value of attribute subjects.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#[](k) ⇒ Object
-
#dig(*args) ⇒ Object
-
#initialize(solr_result, full = false) ⇒ Record
constructor
A new instance of Record.
-
#note(type) ⇒ Object
-
#parse_full_title(infinite_item = false) ⇒ Object
-
#request_item ⇒ Object
Methods included from PrefixHelper
app_prefix, #app_prefix, app_prefix_js, #app_prefix_js
Methods included from RecordHelper
#badge_for_type, #icon_for_type, #record_class_for_type, #record_for_type, #record_from_resolved_json
Methods included from JsonHelper
#merge_notes, #process_json_notes
Methods included from ManipulateNode
#inheritance, #process_mixed_content, #strip_mixed_content
Constructor Details
#initialize(solr_result, full = false) ⇒ Record
Returns a new instance of Record.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'public/app/models/record.rb', line 19 def initialize(solr_result, full = false) @raw = solr_result if solr_result['json'].is_a? Hash @json = solr_result['json'] else @json = ASUtils.json_parse(solr_result['json']) || {} end @full = full @primary_type = raw['primary_type'] @uri = raw['uri'] @identifier = parse_identifier @resolved_resource = parse_resource @level = raw['level'] @other_level = json['other_level'] @display_string = parse_full_title @container_display = parse_container_display @container_summary_for_badge = parse_container_summary_for_badge @container_titles_and_uris = parse_container_display(:include_uri => true) @linked_digital_objects = parse_digital_object_instances @notes = parse_notes @dates = parse_dates @lang_materials = parse_lang_materials @external_documents = parse_external_documents @resolved_repository = parse_repository @resolved_top_container = parse_top_container @repository_information = parse_repository_info @subjects = parse_subjects @classifications = parse_classifications @agents = parse_agents(subjects) @extents = parse_extents end |
Instance Attribute Details
#agents ⇒ Object (readonly)
Returns the value of attribute agents
8 9 10 |
# File 'public/app/models/record.rb', line 8 def agents @agents end |
#classifications ⇒ Object (readonly)
Returns the value of attribute classifications
8 9 10 |
# File 'public/app/models/record.rb', line 8 def classifications @classifications end |
#container_display ⇒ Object (readonly)
Returns the value of attribute container_display
8 9 10 |
# File 'public/app/models/record.rb', line 8 def container_display @container_display end |
#container_summary_for_badge ⇒ Object (readonly)
Returns the value of attribute container_summary_for_badge
8 9 10 |
# File 'public/app/models/record.rb', line 8 def container_summary_for_badge @container_summary_for_badge end |
#container_titles_and_uris ⇒ Object (readonly)
Returns the value of attribute container_titles_and_uris
8 9 10 |
# File 'public/app/models/record.rb', line 8 def container_titles_and_uris @container_titles_and_uris end |
#criteria ⇒ Object
Returns the value of attribute criteria
15 16 17 |
# File 'public/app/models/record.rb', line 15 def criteria @criteria end |
#dates ⇒ Object (readonly)
Returns the value of attribute dates
8 9 10 |
# File 'public/app/models/record.rb', line 8 def dates @dates end |
#display_string ⇒ Object (readonly)
Returns the value of attribute display_string
8 9 10 |
# File 'public/app/models/record.rb', line 8 def display_string @display_string end |
#extents ⇒ Object (readonly)
Returns the value of attribute extents
8 9 10 |
# File 'public/app/models/record.rb', line 8 def extents @extents end |
#external_documents ⇒ Object (readonly)
Returns the value of attribute external_documents
8 9 10 |
# File 'public/app/models/record.rb', line 8 def external_documents @external_documents end |
#full ⇒ Object (readonly)
Returns the value of attribute full
8 9 10 |
# File 'public/app/models/record.rb', line 8 def full @full end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier
8 9 10 |
# File 'public/app/models/record.rb', line 8 def identifier @identifier end |
#json ⇒ Object (readonly)
Returns the value of attribute json
8 9 10 |
# File 'public/app/models/record.rb', line 8 def json @json end |
#lang_materials ⇒ Object (readonly)
Returns the value of attribute lang_materials
8 9 10 |
# File 'public/app/models/record.rb', line 8 def lang_materials @lang_materials end |
#level ⇒ Object (readonly)
Returns the value of attribute level
8 9 10 |
# File 'public/app/models/record.rb', line 8 def level @level end |
#linked_digital_objects ⇒ Object (readonly)
Returns the value of attribute linked_digital_objects
8 9 10 |
# File 'public/app/models/record.rb', line 8 def linked_digital_objects @linked_digital_objects end |
#notes ⇒ Object (readonly)
Returns the value of attribute notes
8 9 10 |
# File 'public/app/models/record.rb', line 8 def notes @notes end |
#other_level ⇒ Object (readonly)
Returns the value of attribute other_level
8 9 10 |
# File 'public/app/models/record.rb', line 8 def other_level @other_level end |
#primary_type ⇒ Object (readonly)
Returns the value of attribute primary_type
8 9 10 |
# File 'public/app/models/record.rb', line 8 def primary_type @primary_type end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw
8 9 10 |
# File 'public/app/models/record.rb', line 8 def raw @raw end |
#repository_information ⇒ Object (readonly)
Returns the value of attribute repository_information
8 9 10 |
# File 'public/app/models/record.rb', line 8 def repository_information @repository_information end |
#resolved_repository ⇒ Object (readonly)
Returns the value of attribute resolved_repository
8 9 10 |
# File 'public/app/models/record.rb', line 8 def resolved_repository @resolved_repository end |
#resolved_resource ⇒ Object (readonly)
Returns the value of attribute resolved_resource
8 9 10 |
# File 'public/app/models/record.rb', line 8 def resolved_resource @resolved_resource end |
#resolved_top_container ⇒ Object (readonly)
Returns the value of attribute resolved_top_container
8 9 10 |
# File 'public/app/models/record.rb', line 8 def resolved_top_container @resolved_top_container end |
#subjects ⇒ Object (readonly)
Returns the value of attribute subjects
8 9 10 |
# File 'public/app/models/record.rb', line 8 def subjects @subjects end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri
8 9 10 |
# File 'public/app/models/record.rb', line 8 def uri @uri end |
Instance Method Details
#[](k) ⇒ Object
56 57 58 59 60 61 62 |
# File 'public/app/models/record.rb', line 56 def [](k) if k == 'json' json else raw[k] end end |
#dig(*args) ⇒ Object
64 65 66 |
# File 'public/app/models/record.rb', line 64 def dig(*args) json.dig(args) end |
#note(type) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 |
# File 'public/app/models/record.rb', line 68 def note(type) if notes && notes[type] note = notes[type][0].clone for i in 1...notes[type].length note = merge_notes(note, notes[type][i]) end note else {} end end |
#parse_full_title(infinite_item = false) ⇒ Object
86 87 88 89 90 91 |
# File 'public/app/models/record.rb', line 86 def parse_full_title(infinite_item = false) unless infinite_item || json['title_inherited'].blank? || (json['display_string'] || '') == json['title'] return "#{json['title']}, #{json['display_string']}" end return process_mixed_content(json['display_string'] || json['title'], :preserve_newlines => true) end |
#request_item ⇒ Object
80 81 82 83 84 |
# File 'public/app/models/record.rb', line 80 def request_item return unless RequestItem.allow_for_type(resolved_repository.dig('repo_code'), primary_type.intern) build_request_item end |