class Caracal::Core::Models::MarginModel

This class handles block options passed to the margins method.

Attributes

margin_bottom[R]
margin_left[R]
margin_right[R]
margin_top[R]

accessors

Public Class Methods

new(options={}, &block) click to toggle source

initialization

Calls superclass method Caracal::Core::Models::BaseModel::new
# File lib/caracal/core/models/margin_model.rb, line 31
def initialize(options={}, &block)
  @margin_top    = DEFAULT_MARGIN_TOP
  @margin_bottom = DEFAULT_MARGIN_BOTTOM
  @margin_left   = DEFAULT_MARGIN_LEFT
  @margin_right  = DEFAULT_MARGIN_RIGHT
  
  super options, &block
end

Public Instance Methods

valid?() click to toggle source
VALIDATION ==============================
# File lib/caracal/core/models/margin_model.rb, line 57
def valid?
  dims = [:bottom, :left, :right, :top]
  dims.map { |d| send("margin_#{ d }") }.all? { |d| d > 0 }
end

Private Instance Methods

option_keys() click to toggle source
# File lib/caracal/core/models/margin_model.rb, line 68
def option_keys
  [:top, :bottom, :left, :right]
end