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 value 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.
89 90 91 92 93 94 95 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 89 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
109 110 111 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 109 def cropped @attributes[:cropped] end |
#height ⇒ Object
105 106 107 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 105 def height @attributes[:height] end |
#present? ⇒ Boolean
113 114 115 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 113 def present? self.source.present? end |
#source ⇒ Object
97 98 99 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 97 def source @attributes[:source] end |
#to_s ⇒ Object
117 118 119 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 117 def to_s self.cropped || self.source || '' end |
#width ⇒ Object
101 102 103 |
# File 'lib/locomotive/steam/liquid/drops/section_content_proxy.rb', line 101 def width @attributes[:width] end |