class Caracal::Core::Models::TextModel

This class encapsulates the logic needed to store and manipulate text data.

Attributes

text_bgcolor[R]
text_bold[R]
text_color[R]
text_content[R]

accessors

text_font[R]
text_highlight_color[R]
text_italic[R]
text_size[R]
text_style[R]
text_underline[R]
text_vertical_align[R]

Public Instance Methods

run_attributes() click to toggle source

.run_attributes

# File lib/caracal/core/models/text_model.rb, line 39
def run_attributes
  {
    style:            text_style,
    font:             text_font,
    color:            text_color,
    size:             text_size,
    bold:             text_bold,
    italic:           text_italic,
    underline:        text_underline,
    bgcolor:          text_bgcolor,
    highlight_color:  text_highlight_color,
    vertical_align:   text_vertical_align
  }
end
valid?() click to toggle source
VALIDATION ============================
# File lib/caracal/core/models/text_model.rb, line 88
def valid?
  a = [:content]
  a.map { |m| send("text_#{ m }") }.compact.size == a.size
end

Private Instance Methods

method_missing(method, *args, &block) click to toggle source
# File lib/caracal/core/models/text_model.rb, line 103
def method_missing(method, *args, &block)
  # I'm on the fence with respect to this implementation. We're ignoring
  # :method_missing errors to allow syntax flexibility for paragraph-type
  # models.  The issue is the syntax format of those models--the way we pass
  # the content value as a special argument--coupled with the model's
  # ability to accept nested instructions.
  #
  # By ignoring method missing errors here, we can pass the entire paragraph
  # block in the initial, built-in call to :text.
end
option_keys() click to toggle source
# File lib/caracal/core/models/text_model.rb, line 99
def option_keys
  [:content, :style, :font, :color, :size, :bold, :italic, :underline, :bgcolor, :highlight_color, :vertical_align]
end