Class: XES::Attribute
- Inherits:
-
Object
- Object
- XES::Attribute
- Extended by:
- AttributeAccessor
- Defined in:
- lib/xes/attribute.rb
Overview
Attribute represents attribute of XES.
Instance Attribute Summary collapse
-
#cost_amount ⇒ Float
The value of meta attribute “cost:amount”.
-
#cost_driver ⇒ String
The value of meta attribute “cost:driver”.
-
#cost_type ⇒ String
The value of meta attribute “cost:type”.
-
#identity_id ⇒ String
The value of meta attribute “identity:id”.
-
#key ⇒ String
Attribute name.
-
#meta ⇒ Meta
Attribute meta attributes.
-
#semantic_modelReference ⇒ String
The value of meta attribute “semantic:modelReference”.
-
#type ⇒ String
readonly
Attribute type.
-
#value ⇒ String
Attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?) private
-
#format ⇒ Object
Format as a XML element.
-
#formattable? ⇒ Boolean
Return true if the element is formattable.
- #hash ⇒ Object private
-
#initialize(type, key, value, meta = []) ⇒ Attribute
constructor
A new instance of Attribute.
Methods included from AttributeAccessor
Constructor Details
#initialize(type, key, value, meta = []) ⇒ Attribute
Returns a new instance of Attribute.
55 56 57 58 59 60 |
# File 'lib/xes/attribute.rb', line 55 def initialize(type, key, value, =[]) @type = type @key = key @value = value @meta = end |
Instance Attribute Details
#cost_amount ⇒ Float
Returns the value of meta attribute “cost:amount”.
19 |
# File 'lib/xes/attribute.rb', line 19 define_attribute "cost:amount", "float" |
#cost_driver ⇒ String
Returns the value of meta attribute “cost:driver”.
24 |
# File 'lib/xes/attribute.rb', line 24 define_attribute "cost:driver", "string" |
#cost_type ⇒ String
Returns the value of meta attribute “cost:type”.
29 |
# File 'lib/xes/attribute.rb', line 29 define_attribute "cost:type", "string" |
#identity_id ⇒ String
Returns the value of meta attribute “identity:id”.
14 |
# File 'lib/xes/attribute.rb', line 14 define_attribute "identity:id", "id" |
#key ⇒ String
Returns attribute name.
37 38 39 |
# File 'lib/xes/attribute.rb', line 37 def key @key end |
#meta ⇒ Meta
Returns attribute meta attributes.
45 46 47 |
# File 'lib/xes/attribute.rb', line 45 def @meta end |
#semantic_modelReference ⇒ String
Returns the value of meta attribute “semantic:modelReference”.
9 |
# File 'lib/xes/attribute.rb', line 9 define_attribute "semantic:modelReference", "string" |
#type ⇒ String (readonly)
Returns attribute type.
33 34 35 |
# File 'lib/xes/attribute.rb', line 33 def type @type end |
#value ⇒ String
Returns attribute value.
41 42 43 |
# File 'lib/xes/attribute.rb', line 41 def value @value 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.
82 83 84 85 |
# File 'lib/xes/attribute.rb', line 82 def ==(other) return false unless other.kind_of?(self.class) @type == other.type and @key == other.key and @value == other.value and @meta == other. end |
#format ⇒ Object
Format as a XML element.
71 72 73 74 75 76 77 78 79 |
# File 'lib/xes/attribute.rb', line 71 def format raise FormatError.new(self) unless formattable? REXML::Element.new(type).tap do |attribute| attribute.attributes["key"] = @key attribute.attributes["value"] = format_value .each {|m| attribute.elements << m.format if m.formattable?} end end |
#formattable? ⇒ Boolean
Return true if the element is formattable.
66 67 68 |
# File 'lib/xes/attribute.rb', line 66 def formattable? not(@type.nil? or @key.nil? or @value.nil? or @meta.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.
89 90 91 |
# File 'lib/xes/attribute.rb', line 89 def hash @type.hash + @key.hash + @value.hash end |