Class: Voom::Presenters::DSL::Components::Image
- Includes:
- Mixins::Tooltips
- Defined in:
- lib/voom/presenters/dsl/components/image.rb
Direct Known Subclasses
Constant Summary collapse
- VALID_FIT_TYPES =
%i[contain cover fill fit].freeze
- DEFAULT_POSITION =
:center
Instance Attribute Summary collapse
-
#border ⇒ Object
Returns the value of attribute border.
-
#border_color ⇒ Object
Returns the value of attribute border_color.
-
#border_radius ⇒ Object
Returns the value of attribute border_radius.
-
#description ⇒ Object
Returns the value of attribute description.
-
#fit ⇒ Object
Returns the value of attribute fit.
-
#height ⇒ Object
Returns the value of attribute height.
-
#image ⇒ Object
Returns the value of attribute image.
-
#max_height ⇒ Object
Returns the value of attribute max_height.
-
#max_width ⇒ Object
Returns the value of attribute max_width.
-
#min_height ⇒ Object
Returns the value of attribute min_height.
-
#min_width ⇒ Object
Returns the value of attribute min_width.
-
#position ⇒ Object
Returns the value of attribute position.
-
#url ⇒ Object
Returns the value of attribute url.
-
#width ⇒ Object
Returns the value of attribute width.
Attributes inherited from EventBase
Attributes included from Mixins::Event
Attributes inherited from Base
#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type
Instance Method Summary collapse
-
#initialize(**attribs_, &block) ⇒ Image
constructor
A new instance of Image.
Methods included from Mixins::Tooltips
Methods included from Mixins::Event
Methods inherited from Base
Methods included from Pluggable
#include_plugins, #plugin, #plugin_module
Methods included from Mixins::YieldTo
Methods included from Serializer
Methods included from Lockable
Constructor Details
#initialize(**attribs_, &block) ⇒ Image
Returns a new instance of Image.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 26 def initialize(**attribs_, &block) super(type: :image, **attribs_, &block) @image = attribs.delete(:image) @description = attribs.delete(:description) @min_width = validate_size(attribs.delete(:min_width)) @width = validate_size(attribs.delete(:width)) @max_width = validate_size(attribs.delete(:max_width)) @min_height = validate_size(attribs.delete(:min_height)) @height = validate_size(attribs.delete(:height)) @max_height = validate_size(attribs.delete(:max_height)) @border = attribs.delete(:border) @border_color = attribs.delete(:border_color) { :primary } @border_radius = attribs.delete(:border_radius) @fit = validate_fit(attribs.delete(:fit) { :contain }) @position = Array(attribs.delete(:position) { DEFAULT_POSITION }).compact @url = build_url end |
Instance Attribute Details
#border ⇒ Object
Returns the value of attribute border.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def border @border end |
#border_color ⇒ Object
Returns the value of attribute border_color.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def border_color @border_color end |
#border_radius ⇒ Object
Returns the value of attribute border_radius.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def border_radius @border_radius end |
#description ⇒ Object
Returns the value of attribute description.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def description @description end |
#fit ⇒ Object
Returns the value of attribute fit.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def fit @fit end |
#height ⇒ Object
Returns the value of attribute height.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def height @height end |
#image ⇒ Object
Returns the value of attribute image.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def image @image end |
#max_height ⇒ Object
Returns the value of attribute max_height.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def max_height @max_height end |
#max_width ⇒ Object
Returns the value of attribute max_width.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def max_width @max_width end |
#min_height ⇒ Object
Returns the value of attribute min_height.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def min_height @min_height end |
#min_width ⇒ Object
Returns the value of attribute min_width.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def min_width @min_width end |
#position ⇒ Object
Returns the value of attribute position.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def position @position end |
#url ⇒ Object
Returns the value of attribute url.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def url @url end |
#width ⇒ Object
Returns the value of attribute width.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/image.rb', line 11 def width @width end |