Class: Caracal::Core::Models::LinkModel
- Defined in:
- lib/caracal/core/models/link_model.rb
Overview
This class encapsulates the logic needed to store and manipulate link data.
Instance Attribute Summary collapse
-
#link_href ⇒ Object
readonly
readers (create aliases for superclass methods to conform to expected naming convention.).
Attributes inherited from TextModel
#text_bgcolor, #text_bold, #text_color, #text_content, #text_font, #text_italic, #text_size, #text_underline
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ LinkModel
constructor
initialization.
-
#valid? ⇒ Boolean
VALIDATION ===========================.
Methods inherited from TextModel
Constructor Details
#initialize(options = {}, &block) ⇒ LinkModel
initialization
34 35 36 37 38 39 |
# File 'lib/caracal/core/models/link_model.rb', line 34 def initialize(={}, &block) @text_color = DEFAULT_LINK_COLOR @text_underline = DEFAULT_LINK_UNDERLINE super , &block end |
Instance Attribute Details
#link_href ⇒ Object (readonly)
readers (create aliases for superclass methods to conform to expected naming convention.)
23 24 25 |
# File 'lib/caracal/core/models/link_model.rb', line 23 def link_href @link_href end |
Instance Method Details
#valid? ⇒ Boolean
VALIDATION ===========================
58 59 60 61 |
# File 'lib/caracal/core/models/link_model.rb', line 58 def valid? a = [:content, :href] a.map { |m| send("link_#{ m }") }.compact.size == a.size end |