Class: RTM::Axes::String

Inherits:
ItemProxy show all
Defined in:
rtm/lib/rtm/axes.rb,
rtm/lib/rtm/axes/string.rb,
rtm/spec/rtm/axes/string_spec.rb

Overview

--- RTM::Axes::String --------------------------#

Instance Method Summary

Methods inherited from Proxy

#initialize

Constructor Details

This class inherits a constructor from RTM::Axes::Proxy

Instance Method Details

- (Object) reverse_atomify

Returns all Names and Occurrences which have String as data value. If the String is found as value of a Variant, the parent Name is returned.

The result may be empty.

:call-seq:

  reverse_atomify -> Array of Names and Occurrences


18
19
20
21
22
23
24
25
26
27
# File 'rtm/lib/rtm/axes/string.rb', line 18

def reverse_atomify
  index =  @tm.literal_index
  names = index.getNames(@construct).to_a
  occs = index.getOccurrences(@construct).to_a
  variants = index.getVariants(@construct).to_a
  names2 = variants.map{|v| v.parent}
  _res = names + occs + names2 #could be empty
  _res = _res.map{|r| r.axes}
  _res.extend(Characteristics)
end

- (Object) reverse_indicators

Returns the Topic which has this String as indicator (subject identifier) or nil if no such Topic exists.

:call-seq:

  reverse_indicators -> Topic or nil


37
38
39
40
41
# File 'rtm/lib/rtm/axes/string.rb', line 37

def reverse_indicators
  _res = @tm.get_topic_by_subject_identifier(@construct) #Topic or nil
  _res = RTM::Axes::Topic.new(_res,@tm) if _res
  return _res
end

- (Object) reverse_item

Returns one Topic which has this String as item identifer or nil if no such Topic exists.

:call-seq:

  reverse_item -> Topic or nil


51
52
53
54
55
56
57
58
59
# File 'rtm/lib/rtm/axes/string.rb', line 51

def reverse_item
  _res = @tm.get_construct_by_item_identifier(@construct) #Construct or nil TODO -> Topic
  return nil unless _res
  if _res.is_a?(RTM::Topic)
    return RTM::Axes::Topic.new(_res,@tm)
  else
    return nil
  end
end

- (Object) reverse_locators

Returns the Topic which has this String as subject locator or nil if no such Topic exists.

:call-seq:

  reverse_locators -> Topic or nil


69
70
71
72
73
# File 'rtm/lib/rtm/axes/string.rb', line 69

def reverse_locators
  _res = @tm.get_topic_by_subject_locator(@construct) #Topic or nil
  _res = RTM::Axes::Topic.new(_res,@tm) if _res
  return _res #RTM::Axes::Topic or nil
end