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.).
-
#link_internal ⇒ Object
readonly
Returns the value of attribute link_internal.
Attributes inherited from TextModel
#text_bgcolor, #text_bold, #text_color, #text_content, #text_font, #text_highlight_color, #text_italic, #text_size, #text_style, #text_underline, #text_vertical_align
Instance Method Summary collapse
-
#external? ⇒ Boolean
STATE HELPERS =========================.
-
#initialize(options = {}, &block) ⇒ LinkModel
constructor
initialization.
-
#valid? ⇒ Boolean
VALIDATION ============================.
Methods inherited from TextModel
Constructor Details
#initialize(options = {}, &block) ⇒ LinkModel
initialization
37 38 39 40 41 42 |
# File 'lib/caracal/core/models/link_model.rb', line 37 def initialize(={}, &block) @text_color = DEFAULT_LINK_COLOR @text_underline = DEFAULT_LINK_UNDERLINE super , &block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Caracal::Core::Models::TextModel
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 |
#link_internal ⇒ Object (readonly)
Returns the value of attribute link_internal.
24 25 26 |
# File 'lib/caracal/core/models/link_model.rb', line 24 def link_internal @link_internal end |
Instance Method Details
#external? ⇒ Boolean
STATE HELPERS =========================
68 69 70 |
# File 'lib/caracal/core/models/link_model.rb', line 68 def external? !link_internal end |
#valid? ⇒ Boolean
VALIDATION ============================
75 76 77 78 |
# File 'lib/caracal/core/models/link_model.rb', line 75 def valid? a = [:content, :href] a.map { |m| send("link_#{ m }") }.compact.size == a.size end |