Class: XES::Classifier
- Inherits:
-
Object
- Object
- XES::Classifier
- Defined in:
- lib/xes/classifier.rb
Overview
Classifier represents “classifier” element of XES.
Instance Attribute Summary collapse
-
#keys ⇒ String
readonly
Classifier keys.
-
#name ⇒ String
readonly
Classifier name.
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, keys) ⇒ Classifier
constructor
Create a XES classifier element.
Constructor Details
#initialize(name, keys) ⇒ Classifier
Create a XES classifier element.
18 19 20 21 |
# File 'lib/xes/classifier.rb', line 18 def initialize(name, keys) @name = name @keys = keys end |
Instance Attribute Details
#keys ⇒ String (readonly)
Returns classifier keys.
10 11 12 |
# File 'lib/xes/classifier.rb', line 10 def keys @keys end |
#name ⇒ String (readonly)
Returns classifier name.
6 7 8 |
# File 'lib/xes/classifier.rb', line 6 def name @name 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.
45 46 47 48 |
# File 'lib/xes/classifier.rb', line 45 def ==(other) return false unless other.kind_of?(self.class) @name == other.name and @keys == other.keys end |
#format ⇒ REXML::Element
Format as a XML element.
35 36 37 38 39 40 41 42 |
# File 'lib/xes/classifier.rb', line 35 def format raise FormatError.new(self) unless formattable? REXML::Element.new("classifier").tap do |ext| ext.attributes["name"] = @name ext.attributes["keys"] = @keys end end |
#formattable? ⇒ Boolean
Return true if the element is formattable.
27 28 29 |
# File 'lib/xes/classifier.rb', line 27 def formattable? not(@name.nil? or @keys.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.
52 53 54 |
# File 'lib/xes/classifier.rb', line 52 def hash @name.hash + @keys.hash end |