Class: XES::Extension
- Inherits:
-
Object
- Object
- XES::Extension
- Defined in:
- lib/xes/extension.rb
Overview
Extension represents “extension” element of XES.
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
Extension name.
-
#prefix ⇒ String
readonly
Extension prefix.
-
#uri ⇒ String
readonly
Extension URI.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?) private
-
#format ⇒ REXML::Element
Format as a XML element.
-
#formattable? ⇒ Boolean
Return true if the element is formattable.
- #hash ⇒ Object private
-
#initialize(name, prefix, uri) ⇒ Extension
constructor
Create a XES extension element.
Constructor Details
#initialize(name, prefix, uri) ⇒ Extension
Create a XES extension element.
24 25 26 27 28 |
# File 'lib/xes/extension.rb', line 24 def initialize(name, prefix, uri) @name = name @prefix = prefix @uri = uri end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns extension name.
6 7 8 |
# File 'lib/xes/extension.rb', line 6 def name @name end |
#prefix ⇒ String (readonly)
Returns extension prefix.
10 11 12 |
# File 'lib/xes/extension.rb', line 10 def prefix @prefix end |
#uri ⇒ String (readonly)
Returns extension URI.
14 15 16 |
# File 'lib/xes/extension.rb', line 14 def uri @uri end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 56 |
# File 'lib/xes/extension.rb', line 53 def ==(other) return false unless other.kind_of?(self.class) @name == other.name and @prefix == other.prefix and @uri == other.uri end |
#format ⇒ REXML::Element
Format as a XML element.
42 43 44 45 46 47 48 49 50 |
# File 'lib/xes/extension.rb', line 42 def format raise FormatError.new(self) unless formattable? REXML::Element.new("extension").tap do |ext| ext.attributes["name"] = @name ext.attributes["prefix"] = @prefix ext.attributes["uri"] = @uri end end |
#formattable? ⇒ Boolean
Return true if the element is formattable.
34 35 36 |
# File 'lib/xes/extension.rb', line 34 def formattable? not(@name.nil? or @prefix.nil? or @uri.nil?) end |
#hash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
60 61 62 |
# File 'lib/xes/extension.rb', line 60 def hash @name.hash + @prefix.hash + @uri.hash end |