Class: Caracal::Core::Models::TableOfContentsModel
- Defined in:
- lib/caracal/core/models/table_of_contents_model.rb
Overview
This class encapsulates the logic needed to store and manipulate text data.
Instance Attribute Summary collapse
-
#toc_opts ⇒ Object
readonly
accessors.
-
#toc_size ⇒ Object
readonly
Returns the value of attribute toc_size.
-
#toc_title ⇒ Object
readonly
Returns the value of attribute toc_title.
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ TableOfContentsModel
constructor
initialization.
-
#valid? ⇒ Boolean
VALIDATION ============================.
Constructor Details
#initialize(options = {}, &block) ⇒ TableOfContentsModel
initialization
32 33 34 35 36 37 |
# File 'lib/caracal/core/models/table_of_contents_model.rb', line 32 def initialize(={}, &block) @toc_opts ||= DEFAULT_OPTS @toc_size ||= DEFAULT_SIZE @toc_title ||= DEFAULT_TITLE super , &block end |
Instance Attribute Details
#toc_opts ⇒ Object (readonly)
accessors
23 24 25 |
# File 'lib/caracal/core/models/table_of_contents_model.rb', line 23 def toc_opts @toc_opts end |
#toc_size ⇒ Object (readonly)
Returns the value of attribute toc_size.
24 25 26 |
# File 'lib/caracal/core/models/table_of_contents_model.rb', line 24 def toc_size @toc_size end |
#toc_title ⇒ Object (readonly)
Returns the value of attribute toc_title.
25 26 27 |
# File 'lib/caracal/core/models/table_of_contents_model.rb', line 25 def toc_title @toc_title end |
Instance Method Details
#valid? ⇒ Boolean
VALIDATION ============================
65 66 67 68 |
# File 'lib/caracal/core/models/table_of_contents_model.rb', line 65 def valid? a = [:opts, :size, :title] a.map { |m| send("toc_#{ m }") }.compact.size == a.size end |