Class: Rex::Parser::GraphML::Element::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/parser/graphml.rb

Overview

A data element defines the value of an attribute for the parent XML node. See: graphml.graphdrawing.org/specification/xsd.html#element-data

Constant Summary collapse

ELEMENT_NAME =
'data'.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ Data

Returns a new instance of Data.

Parameters:

  • key (String)

    The identifier of the attribute that this object contains a value for.


134
135
136
137
# File 'lib/rex/parser/graphml.rb', line 134

def initialize(key)
  @key = key
  @value = nil
end

Instance Attribute Details

#keyObject

Returns the value of attribute key


148
149
150
# File 'lib/rex/parser/graphml.rb', line 148

def key
  @key
end

#valueObject

Returns the value of attribute value


151
152
153
# File 'lib/rex/parser/graphml.rb', line 151

def value
  @value
end

Class Method Details

.from_xml_attributes(xml_attrs) ⇒ Object


139
140
141
142
143
144
# File 'lib/rex/parser/graphml.rb', line 139

def self.from_xml_attributes(xml_attrs)
  key = xml_attrs['key']
  raise Error::InvalidAttributeError.new('data', 'key') if key.nil?

  new(key)
end