Class: Moxml::Entity::Reference
- Inherits:
-
Object
- Object
- Moxml::Entity::Reference
- 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
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name) ⇒ Reference
constructor
A new instance of Reference.
- #to_xml ⇒ Object
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
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/moxml/entity/reference.rb', line 11 def name @name end |
#parent ⇒ Object
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_xml ⇒ Object
19 20 21 |
# File 'lib/moxml/entity/reference.rb', line 19 def to_xml "&#{name};" end |