module Aspire::Object::ResourceShortcutsMixin

Shortcut methods

Public Instance Methods

article_title() click to toggle source

Returns the title of the journal article associated with this resource @return [String, nil] the journal article title or nil if not applicable

# File lib/aspire/object/resource.rb, line 72
def article_title
  part_title_by_type('Article')
end
book_title() click to toggle source

Returns the title of the book associated with this resource @return [String, nil] the book title or nil if not applicable

# File lib/aspire/object/resource.rb, line 78
def book_title
  part_of_title_by_type('Book')
end
chapter_title() click to toggle source

Returns the title of the book chapter associated with this resource @return [String, nil] the book chapter title or nil if not applicable

# File lib/aspire/object/resource.rb, line 84
def chapter_title
  part_title_by_type('Chapter')
end
citation_title() click to toggle source

Returns the resource title as expected by the Alma reading list loader (Article = article title, book = book title, other = resource title) @return [String] the citation title

# File lib/aspire/object/resource.rb, line 91
def citation_title
  article_title || book_title || title
end
journal_title() click to toggle source

Returns the title of the journal associated with this resource @return [String, nil] the journal title or nil if not applicable

# File lib/aspire/object/resource.rb, line 97
def journal_title
  part_of_title_by_type('Journal')
end
part_of_title() click to toggle source

Returns the title of the parent resource (book, journal etc.) @return [String] the title of the parent resource

# 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) click to toggle source

Returns the title of the parent resource (book, journal etc.) @return [String] the title of the parent resource

# 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() click to toggle source

Returns the title of the part (book chapter, journal article etc.) @return [String] the title of the part

# File lib/aspire/object/resource.rb, line 117
def part_title
  has_part ? has_part.title : nil
end
part_title_by_type(res_type) click to toggle source

Returns the title of the part @param res_type [String] the type of the resource @return [String] the title of the part

# 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