Class: Caracal::Core::Models::ImageModel
- Defined in:
- lib/caracal/core/models/image_model.rb
Overview
This class handles block options passed to the img method.
Instance Attribute Summary collapse
-
#image_align ⇒ Object
readonly
Returns the value of attribute image_align.
-
#image_bottom ⇒ Object
readonly
Returns the value of attribute image_bottom.
-
#image_height ⇒ Object
readonly
Returns the value of attribute image_height.
-
#image_left ⇒ Object
readonly
Returns the value of attribute image_left.
-
#image_right ⇒ Object
readonly
Returns the value of attribute image_right.
-
#image_top ⇒ Object
readonly
Returns the value of attribute image_top.
-
#image_url ⇒ Object
readonly
accessors.
-
#image_width ⇒ Object
readonly
Returns the value of attribute image_width.
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ ImageModel
constructor
initialization.
-
#valid? ⇒ Boolean
VALIDATION ==============================.
Constructor Details
#initialize(options = {}, &block) ⇒ ImageModel
initialization
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/caracal/core/models/image_model.rb', line 37 def initialize(={}, &block) @image_width = DEFAULT_IMAGE_WIDTH @image_height = DEFAULT_IMAGE_HEIGHT @image_align = DEFAULT_IMAGE_ALIGN @image_top = DEFAULT_IMAGE_TOP @image_bottom = DEFAULT_IMAGE_BOTTOM @image_left = DEFAULT_IMAGE_LEFT @image_right = DEFAULT_IMAGE_RIGHT super , &block end |
Instance Attribute Details
#image_align ⇒ Object (readonly)
Returns the value of attribute image_align.
29 30 31 |
# File 'lib/caracal/core/models/image_model.rb', line 29 def image_align @image_align end |
#image_bottom ⇒ Object (readonly)
Returns the value of attribute image_bottom.
31 32 33 |
# File 'lib/caracal/core/models/image_model.rb', line 31 def image_bottom @image_bottom end |
#image_height ⇒ Object (readonly)
Returns the value of attribute image_height.
28 29 30 |
# File 'lib/caracal/core/models/image_model.rb', line 28 def image_height @image_height end |
#image_left ⇒ Object (readonly)
Returns the value of attribute image_left.
32 33 34 |
# File 'lib/caracal/core/models/image_model.rb', line 32 def image_left @image_left end |
#image_right ⇒ Object (readonly)
Returns the value of attribute image_right.
33 34 35 |
# File 'lib/caracal/core/models/image_model.rb', line 33 def image_right @image_right end |
#image_top ⇒ Object (readonly)
Returns the value of attribute image_top.
30 31 32 |
# File 'lib/caracal/core/models/image_model.rb', line 30 def image_top @image_top end |
#image_url ⇒ Object (readonly)
accessors
26 27 28 |
# File 'lib/caracal/core/models/image_model.rb', line 26 def image_url @image_url end |
#image_width ⇒ Object (readonly)
Returns the value of attribute image_width.
27 28 29 |
# File 'lib/caracal/core/models/image_model.rb', line 27 def image_width @image_width end |
Instance Method Details
#valid? ⇒ Boolean
VALIDATION ==============================
90 91 92 93 |
# File 'lib/caracal/core/models/image_model.rb', line 90 def valid? dims = [:width, :height, :top, :bottom, :left, :right].map { |m| send("image_#{ m }") } dims.all? { |d| d > 0 } end |