Module: RTM::IO::ToHash::Topic
- Defined in:
- lib/rtm/io/to_hash.rb
Instance Method Summary collapse
-
#to_hash ⇒ Object
Returns the Hash representation of this topic.
Instance Method Details
#to_hash ⇒ Object
Returns the Hash representation of this topic.
The returned Hash holds information about the :subject_identifiers, the :item_identifiers, the :subject_locators, the :names and the :occurrences.
:call-seq:
to_hash -> Hash
38 39 40 41 42 43 44 45 46 |
# File 'lib/rtm/io/to_hash.rb', line 38 def to_hash h = {} h[:item_identifiers] = item_identifiers.map{|i| i.reference} unless item_identifiers.empty? h[:subject_identifiers] = subject_identifiers.map{|i| i.reference} unless subject_identifiers.empty? h[:subject_locators] = subject_locators.map{|i| i.reference} unless subject_locators.empty? h[:names] = names.map{|i| i.to_hash} unless names.empty? h[:occurrences] = occurrences.map{|i| i.to_hash} unless occurrences.empty? h end |