Module: RTM::AR::IO::TOJTM::TopicName

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

Instance Method Summary collapse

Instance Method Details

#to_jtm(*a) ⇒ Object Also known as: to_json



85
86
87
# File 'lib/rtm/activerecord/io/to_jtm.rb', line 85

def to_jtm(*a)
  to_jtm_hash.to_json(*a)
end

#to_jtm_hash(*a) ⇒ Object



75
76
77
78
79
80
81
82
83
84
# File 'lib/rtm/activerecord/io/to_jtm.rb', line 75

def to_jtm_hash(*a)
  j={}
  j['reifier'] = reifier.to_jtm_ref if reifier
  j['item_identifiers'] = item_identifiers.map{|i| i.reference} unless item_identifiers.empty?
  j['value'] = value if value
  j['type'] = type.to_jtm_ref if type
  j['scope'] = scope.map{|i| i.to_jtm_hash} unless scope.empty?
  j['variants'] = variants.map{|i| i.to_jtm_hash} unless variants.empty?
  j
end