Class: Arrolio::Content::List::Item
- Inherits:
-
Object
- Object
- Arrolio::Content::List::Item
- Defined in:
- lib/arrolio/content/list.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#marker ⇒ Object
readonly
Returns the value of attribute marker.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(content, marker: nil) ⇒ Item
constructor
A new instance of Item.
- #text ⇒ Object
Constructor Details
#initialize(content, marker: nil) ⇒ Item
Returns a new instance of Item.
36 37 38 39 40 |
# File 'lib/arrolio/content/list.rb', line 36 def initialize(content, marker: nil) @content = Array(content).freeze @marker = marker freeze end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
34 35 36 |
# File 'lib/arrolio/content/list.rb', line 34 def content @content end |
#marker ⇒ Object (readonly)
Returns the value of attribute marker.
34 35 36 |
# File 'lib/arrolio/content/list.rb', line 34 def marker @marker end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
48 49 50 |
# File 'lib/arrolio/content/list.rb', line 48 def ==(other) other.is_a?(self.class) && content == other.content && marker == other.marker end |
#hash ⇒ Object
54 55 56 |
# File 'lib/arrolio/content/list.rb', line 54 def hash [self.class, content, marker].hash end |
#text ⇒ Object
42 43 44 45 46 |
# File 'lib/arrolio/content/list.rb', line 42 def text @content.map do |node| node.is_a?(Paragraph) ? node.text : node.to_s end.join(' ') end |