Class: SyntaxTree::XML::ExternalID

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/xml/nodes.rb

Overview

An external ID is a child of a document type declaration. It represents the location where the external identifier is located. It contains a type (either system or public), an optional public id literal, and the system literal.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(type:, public_id:, system_id:, location:) ⇒ ExternalID

Returns a new instance of ExternalID.



188
189
190
191
192
# File 'lib/syntax_tree/xml/nodes.rb', line 188

def initialize(type:, public_id:, system_id:, location:)
  @type = type
  @public_id = public_id
  @system_id = system_id
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



186
187
188
# File 'lib/syntax_tree/xml/nodes.rb', line 186

def location
  @location
end

#public_idObject (readonly)

Returns the value of attribute public_id.



186
187
188
# File 'lib/syntax_tree/xml/nodes.rb', line 186

def public_id
  @public_id
end

#system_idObject (readonly)

Returns the value of attribute system_id.



186
187
188
# File 'lib/syntax_tree/xml/nodes.rb', line 186

def system_id
  @system_id
end

#typeObject (readonly)

Returns the value of attribute type.



186
187
188
# File 'lib/syntax_tree/xml/nodes.rb', line 186

def type
  @type
end

Instance Method Details

#accept(visitor) ⇒ Object



194
195
196
# File 'lib/syntax_tree/xml/nodes.rb', line 194

def accept(visitor)
  visitor.visit_external_id(self)
end

#child_nodesObject Also known as: deconstruct



198
199
200
# File 'lib/syntax_tree/xml/nodes.rb', line 198

def child_nodes
  [type, public_id, system_id].compact
end

#deconstruct_keys(keys) ⇒ Object



204
205
206
207
208
209
210
211
# File 'lib/syntax_tree/xml/nodes.rb', line 204

def deconstruct_keys(keys)
  {
    type: type,
    public_id: public_id,
    system_id: system_id,
    location: location
  }
end