Class: FormattedString

Inherits:
String show all
Defined in:
lib/asciidoctor/pdf/formatted_string.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from String

#as_pdf, #pred, #to_pdf_object

Constructor Details

#initialize(fragments) ⇒ FormattedString

Returns a new instance of FormattedString.



6
7
8
# File 'lib/asciidoctor/pdf/formatted_string.rb', line 6

def initialize fragments
  super [].tap {|accum| (@fragments = fragments).each {|it| accum << it[:text] } }.join
end

Instance Attribute Details

#fragmentsObject (readonly)

Returns the value of attribute fragments.



4
5
6
# File 'lib/asciidoctor/pdf/formatted_string.rb', line 4

def fragments
  @fragments
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/asciidoctor/pdf/formatted_string.rb', line 10

def eql? other
  super && (FormattedString === other ? (@fragments ||= nil) == other.fragments : true)
end