Module: RTM::IO::ToHash::Variant

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

Instance Method Summary

Instance Method Details

- (Object) to_hash

Returns the Hash representation of this variant.

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

:call-seq:

  to_hash -> Hash


141
142
143
144
145
146
147
148
# File 'rtm/lib/rtm/io/to_hash.rb', line 141

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[:scope] = scope.map{|i| i.reference} unless scope.empty?
  h
end