Class: Arrolio::Content::FigureGroup
- Inherits:
-
Object
- Object
- Arrolio::Content::FigureGroup
- Defined in:
- lib/arrolio/content/figure_group.rb
Overview
A figure group: optional Image plus optional caption Paragraph. Replaces the previous flat [Image, Paragraph] emission from convert_figure. The flow builder renders the group as a keep-together unit so the caption never lands on a different page from the image.
Instance Attribute Summary collapse
-
#caption ⇒ Object
readonly
Returns the value of attribute caption.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#style_id ⇒ Object
readonly
Returns the value of attribute style_id.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #empty? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(image: nil, caption: nil, id: nil, style_id: :figure) ⇒ FigureGroup
constructor
A new instance of FigureGroup.
Constructor Details
#initialize(image: nil, caption: nil, id: nil, style_id: :figure) ⇒ FigureGroup
Returns a new instance of FigureGroup.
13 14 15 16 17 18 19 |
# File 'lib/arrolio/content/figure_group.rb', line 13 def initialize(image: nil, caption: nil, id: nil, style_id: :figure) @image = image @caption = caption @id = id&.to_s @style_id = style_id.to_sym freeze end |
Instance Attribute Details
#caption ⇒ Object (readonly)
Returns the value of attribute caption.
11 12 13 |
# File 'lib/arrolio/content/figure_group.rb', line 11 def caption @caption end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
11 12 13 |
# File 'lib/arrolio/content/figure_group.rb', line 11 def id @id end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
11 12 13 |
# File 'lib/arrolio/content/figure_group.rb', line 11 def image @image end |
#style_id ⇒ Object (readonly)
Returns the value of attribute style_id.
11 12 13 |
# File 'lib/arrolio/content/figure_group.rb', line 11 def style_id @style_id end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
25 26 27 28 29 30 31 |
# File 'lib/arrolio/content/figure_group.rb', line 25 def ==(other) other.is_a?(self.class) && image == other.image && caption == other.caption && id == other.id && style_id == other.style_id end |
#empty? ⇒ Boolean
21 22 23 |
# File 'lib/arrolio/content/figure_group.rb', line 21 def empty? @image.nil? && (@caption.nil? || (@caption.is_a?(Paragraph) && @caption.empty?)) end |
#hash ⇒ Object
34 35 36 |
# File 'lib/arrolio/content/figure_group.rb', line 34 def hash [self.class, image, caption, id, style_id].hash end |