Class: Locomotive::Steam::Liquid::Drops::SectionImagePickerField
- Inherits:
-
Liquid::Drop
- Object
- Liquid::Drop
- Locomotive::Steam::Liquid::Drops::SectionImagePickerField
- Defined in:
- lib/locomotive/steam/liquid/drops/section_content_proxy.rb
Overview
Drop representing the valud of an image picker. It holds extra attributes like: the width, height, format and cropped of the image
Instance Method Summary collapse
- #cropped ⇒ Object
- #height ⇒ Object
-
#initialize(url_or_attributes) ⇒ SectionImagePickerField
constructor
A new instance of SectionImagePickerField.
- #present? ⇒ Boolean
- #source ⇒ Object
- #to_s ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(url_or_attributes) ⇒ SectionImagePickerField
Returns a new instance of SectionImagePickerField.
50 51 52 53 54 55 56 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 50 def initialize(url_or_attributes) if url_or_attributes.is_a?(String) || url_or_attributes.blank? @attributes = { source: url_or_attributes } else @attributes = url_or_attributes.symbolize_keys || {} end end |
Instance Method Details
#cropped ⇒ Object
70 71 72 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 70 def cropped @attributes[:cropped] end |
#height ⇒ Object
66 67 68 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 66 def height @attributes[:height] end |
#present? ⇒ Boolean
74 75 76 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 74 def present? self.source.present? end |
#source ⇒ Object
58 59 60 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 58 def source @attributes[:source] end |
#to_s ⇒ Object
78 79 80 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 78 def to_s self.cropped || self.source || '' end |
#width ⇒ Object
62 63 64 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 62 def width @attributes[:width] end |