Class: Caracal::Core::Models::FieldModel

Inherits:
BaseModel
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#initialize

Constructor Details

This class inherits a constructor from Caracal::Core::Models::BaseModel

Instance Attribute Details

#field_bgcolorObject (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_boldObject (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_colorObject (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_dirtyObject (readonly)

accessors



21
22
23
# File 'lib/caracal/core/models/field_model.rb', line 21

def field_dirty
  @field_dirty
end

#field_fontObject (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_colorObject (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_italicObject (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_sizeObject (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_styleObject (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_typeObject (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_underlineObject (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_alignObject (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_typeObject

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_attributesObject

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

Returns:

  • (Boolean)


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