Module: Aspire::Object::ResourceShortcutsMixin
- Included in:
- Resource
- Defined in:
- lib/aspire/object/resource.rb
Overview
Shortcut methods
Instance Method Summary collapse
-
#article_title ⇒ String?
Returns the title of the journal article associated with this resource.
-
#book_title ⇒ String?
Returns the title of the book associated with this resource.
-
#chapter_title ⇒ String?
Returns the title of the book chapter associated with this resource.
-
#citation_title ⇒ String
Returns the resource title as expected by the Alma reading list loader (Article = article title, book = book title, other = resource title).
-
#journal_title ⇒ String?
Returns the title of the journal associated with this resource.
-
#part_of_title ⇒ String
Returns the title of the parent resource (book, journal etc.).
-
#part_of_title_by_type(res_type) ⇒ String
Returns the title of the parent resource (book, journal etc.).
-
#part_title ⇒ String
Returns the title of the part (book chapter, journal article etc.).
-
#part_title_by_type(res_type) ⇒ String
Returns the title of the part.
Instance Method Details
#article_title ⇒ String?
Returns the title of the journal article associated with this resource
72 73 74 |
# File 'lib/aspire/object/resource.rb', line 72 def article_title part_title_by_type('Article') end |
#book_title ⇒ String?
Returns the title of the book associated with this resource
78 79 80 |
# File 'lib/aspire/object/resource.rb', line 78 def book_title part_of_title_by_type('Book') end |
#chapter_title ⇒ String?
Returns the title of the book chapter associated with this resource
84 85 86 |
# File 'lib/aspire/object/resource.rb', line 84 def chapter_title part_title_by_type('Chapter') end |
#citation_title ⇒ String
Returns the resource title as expected by the Alma reading list loader (Article = article title, book = book title, other = resource title)
91 92 93 |
# File 'lib/aspire/object/resource.rb', line 91 def citation_title article_title || book_title || title end |
#journal_title ⇒ String?
Returns the title of the journal associated with this resource
97 98 99 |
# File 'lib/aspire/object/resource.rb', line 97 def journal_title part_of_title_by_type('Journal') end |
#part_of_title ⇒ String
Returns the title of the parent resource (book, journal etc.)
103 104 105 |
# File 'lib/aspire/object/resource.rb', line 103 def part_of_title is_part_of ? is_part_of.title : nil end |
#part_of_title_by_type(res_type) ⇒ String
Returns the title of the parent resource (book, journal etc.)
109 110 111 112 113 |
# File 'lib/aspire/object/resource.rb', line 109 def part_of_title_by_type(res_type) return title if type == res_type return is_part_of.title if is_part_of && is_part_of.type == res_type nil end |
#part_title ⇒ String
Returns the title of the part (book chapter, journal article etc.)
117 118 119 |
# File 'lib/aspire/object/resource.rb', line 117 def part_title has_part ? has_part.title : nil end |
#part_title_by_type(res_type) ⇒ String
Returns the title of the part
124 125 126 127 128 |
# File 'lib/aspire/object/resource.rb', line 124 def part_title_by_type(res_type) return title if type == res_type return has_part.title if has_part && has_part.type == res_type nil end |