Class: Caracal::Core::Models::MarginModel
- Defined in:
- lib/caracal/core/models/margin_model.rb
Overview
This class handles block options passed to the margins method.
Instance Attribute Summary collapse
-
#margin_bottom ⇒ Object
readonly
Returns the value of attribute margin_bottom.
-
#margin_left ⇒ Object
readonly
Returns the value of attribute margin_left.
-
#margin_right ⇒ Object
readonly
Returns the value of attribute margin_right.
-
#margin_top ⇒ Object
readonly
accessors.
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ MarginModel
constructor
initialization.
-
#valid? ⇒ Boolean
VALIDATION ==============================.
Constructor Details
#initialize(options = {}, &block) ⇒ MarginModel
initialization
31 32 33 34 35 36 37 38 |
# File 'lib/caracal/core/models/margin_model.rb', line 31 def initialize(={}, &block) @margin_top = DEFAULT_MARGIN_TOP @margin_bottom = DEFAULT_MARGIN_BOTTOM @margin_left = DEFAULT_MARGIN_LEFT @margin_right = DEFAULT_MARGIN_RIGHT super , &block end |
Instance Attribute Details
#margin_bottom ⇒ Object (readonly)
Returns the value of attribute margin_bottom.
25 26 27 |
# File 'lib/caracal/core/models/margin_model.rb', line 25 def margin_bottom @margin_bottom end |
#margin_left ⇒ Object (readonly)
Returns the value of attribute margin_left.
26 27 28 |
# File 'lib/caracal/core/models/margin_model.rb', line 26 def margin_left @margin_left end |
#margin_right ⇒ Object (readonly)
Returns the value of attribute margin_right.
27 28 29 |
# File 'lib/caracal/core/models/margin_model.rb', line 27 def margin_right @margin_right end |
#margin_top ⇒ Object (readonly)
accessors
24 25 26 |
# File 'lib/caracal/core/models/margin_model.rb', line 24 def margin_top @margin_top end |
Instance Method Details
#valid? ⇒ Boolean
VALIDATION ==============================
57 58 59 60 |
# 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 |