Class: Moxml::Adapter::CustomizedLeptris::TextSegment

Inherits:
Object
  • Object
show all
Defined in:
lib/moxml/adapter/customized_leptris/text_segment.rb

Overview

A text run split out of a native text node that carried entity markers. Value object: the moxml contract exposes text nodes as separate children around entity references, while libleptris stores them as one marker-bearing text node.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content, parent = nil) ⇒ TextSegment

Returns a new instance of TextSegment.



15
16
17
18
# File 'lib/moxml/adapter/customized_leptris/text_segment.rb', line 15

def initialize(content, parent = nil)
  @content = content
  @parent = parent
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



13
14
15
# File 'lib/moxml/adapter/customized_leptris/text_segment.rb', line 13

def content
  @content
end

#parentObject

Returns the value of attribute parent.



11
12
13
# File 'lib/moxml/adapter/customized_leptris/text_segment.rb', line 11

def parent
  @parent
end

Instance Method Details

#==(other) ⇒ Object



20
21
22
# File 'lib/moxml/adapter/customized_leptris/text_segment.rb', line 20

def ==(other)
  other.is_a?(self.class) && content == other.content
end