class Caracal::Core::Models::StyleModel
This class encapsulates the logic needed to store and manipulate paragraph style data.
Attributes
style_align[R]
style_base[R]
style_bold[R]
style_bottom[R]
style_caps[R]
style_color[R]
style_default[R]
accessors
style_font[R]
style_id[R]
style_indent_first[R]
style_indent_left[R]
style_indent_right[R]
style_italic[R]
style_line[R]
style_name[R]
style_next[R]
style_size[R]
style_top[R]
style_type[R]
style_underline[R]
Public Class Methods
new(options={}, &block)
click to toggle source
initialization
Calls superclass method
Caracal::Core::Models::BaseModel::new
# File lib/caracal/core/models/style_model.rb, line 55 def initialize(options={}, &block) @style_default = false @style_type = DEFAULT_STYLE_TYPE @style_base = DEFAULT_STYLE_BASE @style_next = DEFAULT_STYLE_NEXT super options, &block if (style_id == DEFAULT_STYLE_BASE) @style_default ||= true @style_color ||= DEFAULT_STYLE_COLOR @style_size ||= DEFAULT_STYLE_SIZE @style_bold ||= DEFAULT_STYLE_BOLD @style_italic ||= DEFAULT_STYLE_ITALIC @style_underline ||= DEFAULT_STYLE_UNDERLINE @style_caps ||= DEFAULT_STYLE_CAPS @style_align ||= DEFAULT_STYLE_ALIGN @style_top ||= DEFAULT_STYLE_TOP @style_bottom ||= DEFAULT_STYLE_BOTTOM @style_line ||= DEFAULT_STYLE_LINE end end
Public Instance Methods
matches?(str)
click to toggle source
type(value)
click to toggle source
custom
# File lib/caracal/core/models/style_model.rb, line 114 def type(value) allowed = ['character', 'paragraph'] given = value.to_s.downcase.strip @style_type = allowed.include?(given) ? given : DEFAULT_STYLE_TYPE end
Private Instance Methods
option_keys()
click to toggle source
# File lib/caracal/core/models/style_model.rb, line 141 def option_keys [ :type, :bold, :italic, :underline, :caps, :top, :bottom, :size, :line, :id, :name, :color, :font, :align, :indent_left, :indent_right, :indent_first ] end