Module: RTM::AR::TOSTRING::TopicMap

Defined in:
lib/rtm/activerecord/io/to_string.rb

Instance Method Summary collapse

Instance Method Details

#to_s(style = :short) ⇒ Object

Returns different String representations. Try :short (default), :long, :super (original)



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rtm/activerecord/io/to_string.rb', line 10

def to_s(style=:short)
  case style
  when :short
    "#<RTM::TopicMap id=#{id} base_locator=\"#{base_locator}\">"
  when :long
    r = " #{reifier.to_s(:short)}" if reifier
    i = " iids=#{item_identifiers.to_s}" unless item_identifiers.empty?
    "#<RTM::TopicMap id=#{id} base_locator=\"#{base_locator}\"#{r}#{i} topics:#{topics.size} associations:#{associations.size}>"
  else
    super() # these () are needed, otherwise the own parameters are passed in
  end
end