Class: Arrolio::Content::Image
- Inherits:
-
Object
- Object
- Arrolio::Content::Image
- Defined in:
- lib/arrolio/content/image.rb
Instance Attribute Summary collapse
-
#alt ⇒ Object
readonly
Returns the value of attribute alt.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
-
#style_id ⇒ Object
readonly
Returns the value of attribute style_id.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(src, width: nil, height: nil, alt: nil, style_id: :figure_image, id: nil) ⇒ Image
constructor
A new instance of Image.
Constructor Details
#initialize(src, width: nil, height: nil, alt: nil, style_id: :figure_image, id: nil) ⇒ Image
Returns a new instance of Image.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/arrolio/content/image.rb', line 8 def initialize(src, width: nil, height: nil, alt: nil, style_id: :figure_image, id: nil) @src = src.to_s @width = width&.to_f @height = height&.to_f @alt = alt @style_id = style_id.to_sym @id = id freeze end |
Instance Attribute Details
#alt ⇒ Object (readonly)
Returns the value of attribute alt.
6 7 8 |
# File 'lib/arrolio/content/image.rb', line 6 def alt @alt end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
6 7 8 |
# File 'lib/arrolio/content/image.rb', line 6 def height @height end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/arrolio/content/image.rb', line 6 def id @id end |
#src ⇒ Object (readonly)
Returns the value of attribute src.
6 7 8 |
# File 'lib/arrolio/content/image.rb', line 6 def src @src end |
#style_id ⇒ Object (readonly)
Returns the value of attribute style_id.
6 7 8 |
# File 'lib/arrolio/content/image.rb', line 6 def style_id @style_id end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
6 7 8 |
# File 'lib/arrolio/content/image.rb', line 6 def width @width end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
19 20 21 22 23 24 25 26 27 |
# File 'lib/arrolio/content/image.rb', line 19 def ==(other) other.is_a?(self.class) && src == other.src && width == other.width && height == other.height && alt == other.alt && style_id == other.style_id && id == other.id end |
#hash ⇒ Object
31 32 33 |
# File 'lib/arrolio/content/image.rb', line 31 def hash [self.class, src, width, height, alt, style_id, id].hash end |