Class: Caracal::Core::Models::LinkModel

Inherits:
TextModel show all
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

Attributes inherited from TextModel

#text_bgcolor, #text_bold, #text_color, #text_content, #text_font, #text_italic, #text_size, #text_underline

Instance Method Summary collapse

Methods inherited from TextModel

#run_attributes

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(options={}, &block)
  @text_color     = DEFAULT_LINK_COLOR
  @text_underline = DEFAULT_LINK_UNDERLINE

  super options, &block
end

Instance Attribute Details

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 ===========================

Returns:

  • (Boolean)


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