Module: BookmarkSystem::Bookmarker
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/bookmark_system/bookmarker.rb
Overview
Bookmarker module
This module defines bookmarker behavior in bookmark system
Instance Method Summary collapse
-
#bookmark(bookmarkee) ⇒ Boolean
Creates a Bookmark relationship between self and a Bookmarkee object.
-
#bookmarkees_by(klass) ⇒ ActiveRecord::Relation
Retrieves a scope of Bookmark objects that are bookmarked by self.
-
#bookmarks?(bookmarkee) ⇒ Boolean
Specifies if self bookmarks a Bookmarker object.
-
#is_bookmarker? ⇒ Boolean
Specifies if self can bookmark Bookmarkee objects.
-
#toggle_bookmark(bookmarkee) ⇒ Boolean
Toggles a Bookmark relationship between self and a Bookmarkee object.
-
#unbookmark(bookmarkee) ⇒ Boolean
Destroys a Bookmark relationship between self and a Bookmarkee object.
Instance Method Details
#bookmark(bookmarkee) ⇒ Boolean
Creates a BookmarkSystem::Bookmark relationship between self and a BookmarkSystem::Bookmarkee object
43 44 45 |
# File 'lib/bookmark_system/bookmarker.rb', line 43 def bookmark(bookmarkee) Bookmark.bookmark(self, bookmarkee) end |
#bookmarkees_by(klass) ⇒ ActiveRecord::Relation
Retrieves a scope of BookmarkSystem::Bookmark objects that are bookmarked by self
83 84 85 |
# 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) ⇒ Boolean
Specifies if self bookmarks a BookmarkSystem::Bookmarker object
73 74 75 |
# File 'lib/bookmark_system/bookmarker.rb', line 73 def bookmarks?(bookmarkee) Bookmark.bookmarks?(self, bookmarkee) end |
#is_bookmarker? ⇒ Boolean
Specifies if self can bookmark BookmarkSystem::Bookmarkee objects
33 34 35 |
# File 'lib/bookmark_system/bookmarker.rb', line 33 def is_bookmarker? true end |
#toggle_bookmark(bookmarkee) ⇒ Boolean
Toggles a BookmarkSystem::Bookmark relationship between self and a BookmarkSystem::Bookmarkee object
63 64 65 |
# File 'lib/bookmark_system/bookmarker.rb', line 63 def toggle_bookmark(bookmarkee) Bookmark.toggle_bookmark(self, bookmarkee) end |
#unbookmark(bookmarkee) ⇒ Boolean
Destroys a BookmarkSystem::Bookmark relationship between self and a BookmarkSystem::Bookmarkee object
53 54 55 |
# File 'lib/bookmark_system/bookmarker.rb', line 53 def unbookmark(bookmarkee) Bookmark.unbookmark(self, bookmarkee) end |