blob: c639e54b79a82e53292fa03dfa44e34a4dc4b84d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
# frozen_string_literal: true
class FormattedString < String
attr_reader :fragments
def initialize fragments
super [].tap {|accum| (@fragments = fragments).each {|it| accum << it[:text] } }.join
end
def eql? other
super && (FormattedString === other ? (@fragments ||= nil) == other.fragments : true)
end
end
|