module BookmarkSystem::Bookmarker

Bookmarker module

This module defines bookmarker behavior in bookmark system

Public Instance Methods

bookmark(bookmarkee) click to toggle source

Creates a {Bookmark} relationship between self and a {Bookmarkee} object

@param [Bookmarkee] bookmarkee - the bookmarkee of the {Bookmark} relationship @return [Boolean]

# File lib/bookmark_system/bookmarker.rb, line 43
def bookmark(bookmarkee)
  Bookmark.bookmark(self, bookmarkee)
end
bookmarkees_by(klass) click to toggle source

Retrieves a scope of {Bookmark} objects that are bookmarked by self

@param [Class] klass - the {Class} to include @return [ActiveRecord::Relation]

# File lib/bookmark_system/bookmarker.rb, line 83
def bookmarkees_by(klass)
  Bookmark.scope_by_bookmarker(self).scope_by_bookmarkee_type(klass)
end
bookmarks?(bookmarkee) click to toggle source

Specifies if self bookmarks a {Bookmarker} object

@param [Bookmarkee] bookmarkee - the {Bookmarkee} object to test against @return [Boolean]

# File lib/bookmark_system/bookmarker.rb, line 73
def bookmarks?(bookmarkee)
  Bookmark.bookmarks?(self, bookmarkee)
end
is_bookmarker?() click to toggle source

Specifies if self can bookmark {Bookmarkee} objects

@return [Boolean]

# File lib/bookmark_system/bookmarker.rb, line 33
def is_bookmarker?
  true
end
toggle_bookmark(bookmarkee) click to toggle source

Toggles a {Bookmark} relationship between self and a {Bookmarkee} object

@param [Bookmarkee] bookmarkee - the bookmarkee of the {Bookmark} relationship @return [Boolean]

# File lib/bookmark_system/bookmarker.rb, line 63
def toggle_bookmark(bookmarkee)
  Bookmark.toggle_bookmark(self, bookmarkee)
end
unbookmark(bookmarkee) click to toggle source

Destroys a {Bookmark} relationship between self and a {Bookmarkee} object

@param [Bookmarkee] bookmarkee - the bookmarkee of the {Bookmark} relationship @return [Boolean]

# File lib/bookmark_system/bookmarker.rb, line 53
def unbookmark(bookmarkee)
  Bookmark.unbookmark(self, bookmarkee)
end