Class: Caracal::Core::Models::FieldModel
- Defined in:
- lib/caracal/core/models/field_model.rb
Overview
This class encapsulates the logic needed to store and manipulate text data.
Instance Attribute Summary collapse
-
#field_bgcolor ⇒ Object
readonly
Returns the value of attribute field_bgcolor.
-
#field_bold ⇒ Object
readonly
Returns the value of attribute field_bold.
-
#field_color ⇒ Object
readonly
Returns the value of attribute field_color.
-
#field_dirty ⇒ Object
readonly
accessors.
-
#field_font ⇒ Object
readonly
Returns the value of attribute field_font.
-
#field_highlight_color ⇒ Object
readonly
Returns the value of attribute field_highlight_color.
-
#field_italic ⇒ Object
readonly
Returns the value of attribute field_italic.
-
#field_size ⇒ Object
readonly
Returns the value of attribute field_size.
-
#field_style ⇒ Object
readonly
Returns the value of attribute field_style.
-
#field_type ⇒ Object
readonly
Returns the value of attribute field_type.
-
#field_underline ⇒ Object
readonly
Returns the value of attribute field_underline.
-
#field_vertical_align ⇒ Object
readonly
Returns the value of attribute field_vertical_align.
Class Method Summary collapse
-
.formatted_type(type) ⇒ Object
————————————————————- Public Class Methods ————————————————————-.
Instance Method Summary collapse
-
#formatted_type ⇒ Object
GETTERS ==============================.
-
#run_attributes ⇒ Object
.run_attributes.
-
#valid? ⇒ Boolean
VALIDATION ============================.
Methods inherited from BaseModel
Constructor Details
This class inherits a constructor from Caracal::Core::Models::BaseModel
Instance Attribute Details
#field_bgcolor ⇒ Object (readonly)
Returns the value of attribute field_bgcolor.
30 31 32 |
# File 'lib/caracal/core/models/field_model.rb', line 30 def field_bgcolor @field_bgcolor end |
#field_bold ⇒ Object (readonly)
Returns the value of attribute field_bold.
27 28 29 |
# File 'lib/caracal/core/models/field_model.rb', line 27 def field_bold @field_bold end |
#field_color ⇒ Object (readonly)
Returns the value of attribute field_color.
25 26 27 |
# File 'lib/caracal/core/models/field_model.rb', line 25 def field_color @field_color end |
#field_dirty ⇒ Object (readonly)
accessors
21 22 23 |
# File 'lib/caracal/core/models/field_model.rb', line 21 def field_dirty @field_dirty end |
#field_font ⇒ Object (readonly)
Returns the value of attribute field_font.
24 25 26 |
# File 'lib/caracal/core/models/field_model.rb', line 24 def field_font @field_font end |
#field_highlight_color ⇒ Object (readonly)
Returns the value of attribute field_highlight_color.
31 32 33 |
# File 'lib/caracal/core/models/field_model.rb', line 31 def field_highlight_color @field_highlight_color end |
#field_italic ⇒ Object (readonly)
Returns the value of attribute field_italic.
28 29 30 |
# File 'lib/caracal/core/models/field_model.rb', line 28 def field_italic @field_italic end |
#field_size ⇒ Object (readonly)
Returns the value of attribute field_size.
26 27 28 |
# File 'lib/caracal/core/models/field_model.rb', line 26 def field_size @field_size end |
#field_style ⇒ Object (readonly)
Returns the value of attribute field_style.
23 24 25 |
# File 'lib/caracal/core/models/field_model.rb', line 23 def field_style @field_style end |
#field_type ⇒ Object (readonly)
Returns the value of attribute field_type.
22 23 24 |
# File 'lib/caracal/core/models/field_model.rb', line 22 def field_type @field_type end |
#field_underline ⇒ Object (readonly)
Returns the value of attribute field_underline.
29 30 31 |
# File 'lib/caracal/core/models/field_model.rb', line 29 def field_underline @field_underline end |
#field_vertical_align ⇒ Object (readonly)
Returns the value of attribute field_vertical_align.
32 33 34 |
# File 'lib/caracal/core/models/field_model.rb', line 32 def field_vertical_align @field_vertical_align end |
Class Method Details
.formatted_type(type) ⇒ Object
Public Class Methods
38 39 40 |
# File 'lib/caracal/core/models/field_model.rb', line 38 def self.formatted_type(type) TYPE_MAP.fetch(type.to_s.to_sym) end |
Instance Method Details
#formatted_type ⇒ Object
GETTERS ==============================
49 50 51 |
# File 'lib/caracal/core/models/field_model.rb', line 49 def formatted_type self.class.formatted_type(field_type) end |
#run_attributes ⇒ Object
.run_attributes
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/caracal/core/models/field_model.rb', line 56 def run_attributes { style: field_style, font: field_font, color: field_color, size: field_size, bold: field_bold, italic: field_italic, underline: field_underline, bgcolor: field_bgcolor, highlight_color: field_highlight_color, vertical_align: field_vertical_align } end |
#valid? ⇒ Boolean
VALIDATION ============================
105 106 107 108 |
# File 'lib/caracal/core/models/field_model.rb', line 105 def valid? a = [:type] a.map { |m| send("field_#{ m }") }.compact.size == a.size end |