Module: RTM::IO::ToHash::Occurrence

Defined in:
rtm/lib/rtm/io/to_hash.rb

Instance Method Summary

Instance Method Details

- (Object) to_hash

Returns the Hash representation of this occurrence.

The returned Hash holds information about the :reifier, the :item_identifiers, the :value, the :datatype, the :type and the :scope.

:call-seq:

  to_hash -> Hash


101
102
103
104
105
106
107
108
109
110
# File 'rtm/lib/rtm/io/to_hash.rb', line 101

def to_hash
  h={}
  h[:reifier] = reifier.reference if reifier
  h[:item_identifiers] = item_identifiers.map{|i| i.reference} unless item_identifiers.empty?
  h[:value] = value if value
  h[:datatype] = datatype.reference if datatype
  h[:type] = type.reference if type
  h[:scope] = scope.map{|i| i.reference} unless scope.empty?
  h
end