Class: Marvi::RichLine

Inherits:
Object
  • Object
show all
Defined in:
lib/marvi/document.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spans = [], source_line: nil) ⇒ RichLine

Returns a new instance of RichLine.



19
20
21
22
# File 'lib/marvi/document.rb', line 19

def initialize(spans = [], source_line: nil)
  @spans = spans
  @source_line = source_line
end

Instance Attribute Details

#source_lineObject (readonly)

Returns the value of attribute source_line.



17
18
19
# File 'lib/marvi/document.rb', line 17

def source_line
  @source_line
end

#spansObject (readonly)

Returns the value of attribute spans.



17
18
19
# File 'lib/marvi/document.rb', line 17

def spans
  @spans
end

Class Method Details

.blankObject



28
29
30
# File 'lib/marvi/document.rb', line 28

def self.blank
  new([])
end

Instance Method Details

#plain_textObject



24
25
26
# File 'lib/marvi/document.rb', line 24

def plain_text
  @spans.map(&:text).join
end