Class: Caracal::Core::Models::BookmarkModel
- Defined in:
- lib/caracal/core/models/bookmark_model.rb
Overview
This class encapsulates the logic needed to store and manipulate bookmarks.
Instance Attribute Summary collapse
-
#bookmark_id ⇒ Object
readonly
Returns the value of attribute bookmark_id.
-
#bookmark_name ⇒ Object
readonly
Returns the value of attribute bookmark_name.
-
#bookmark_start ⇒ Object
readonly
accessors.
Instance Method Summary collapse
-
#run_attributes ⇒ Object
.run_attributes.
-
#start? ⇒ Boolean
STATE HELPERS =========================.
-
#valid? ⇒ Boolean
VALIDATION ============================.
Methods inherited from BaseModel
Constructor Details
This class inherits a constructor from Caracal::Core::Models::BaseModel
Instance Attribute Details
#bookmark_id ⇒ Object (readonly)
Returns the value of attribute bookmark_id.
19 20 21 |
# File 'lib/caracal/core/models/bookmark_model.rb', line 19 def bookmark_id @bookmark_id end |
#bookmark_name ⇒ Object (readonly)
Returns the value of attribute bookmark_name.
20 21 22 |
# File 'lib/caracal/core/models/bookmark_model.rb', line 20 def bookmark_name @bookmark_name end |
#bookmark_start ⇒ Object (readonly)
accessors
18 19 20 |
# File 'lib/caracal/core/models/bookmark_model.rb', line 18 def bookmark_start @bookmark_start end |
Instance Method Details
#run_attributes ⇒ Object
.run_attributes
30 31 32 33 34 35 36 |
# File 'lib/caracal/core/models/bookmark_model.rb', line 30 def run_attributes { start: bookmark_start, id: bookmark_id, name: bookmark_name } end |
#start? ⇒ Boolean
STATE HELPERS =========================
58 59 60 |
# File 'lib/caracal/core/models/bookmark_model.rb', line 58 def start? !!bookmark_start end |
#valid? ⇒ Boolean
VALIDATION ============================
65 66 67 68 69 70 |
# File 'lib/caracal/core/models/bookmark_model.rb', line 65 def valid? a = [:id] a << :name if start? a.map { |m| send("bookmark_#{ m }") }.compact.size == a.size end |