Class: Moxml::Entity::Reference

Inherits:
Object
  • Object
show all
Defined in:
lib/moxml/entity/reference.rb

Overview

A named entity reference (&name;) as a value object, for adapters whose native trees cannot represent entity references (ox stores them in the tree; rexml and leptris carry them alongside). Adapter-specific namespaces alias this class so node_type dispatch keeps working.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Reference

Returns a new instance of Reference.



14
15
16
17
# File 'lib/moxml/entity/reference.rb', line 14

def initialize(name)
  @name = name
  @parent = nil
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/moxml/entity/reference.rb', line 11

def name
  @name
end

#parentObject

Returns the value of attribute parent.



12
13
14
# File 'lib/moxml/entity/reference.rb', line 12

def parent
  @parent
end

Instance Method Details

#==(other) ⇒ Object



23
24
25
# File 'lib/moxml/entity/reference.rb', line 23

def ==(other)
  other.is_a?(Reference) && name == other.name
end

#to_xmlObject



19
20
21
# File 'lib/moxml/entity/reference.rb', line 19

def to_xml
  "&#{name};"
end