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

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

Instance Method Summary collapse

Instance Method Details

#to_hashObject

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 '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