Class: NicInfo::ResponseObjSet
- Inherits:
-
Object
- Object
- NicInfo::ResponseObjSet
- Defined in:
- lib/nicinfo/common_json.rb
Overview
for keeping track of objects to display
Instance Method Summary collapse
- #add(respObj) ⇒ Object
- #associateEntities(entities) ⇒ Object
- #associateEventActor(eventActor) ⇒ Object
- #display ⇒ Object
-
#initialize(config) ⇒ ResponseObjSet
constructor
A new instance of ResponseObjSet.
Constructor Details
#initialize(config) ⇒ ResponseObjSet
Returns a new instance of ResponseObjSet.
216 217 218 219 220 221 |
# File 'lib/nicinfo/common_json.rb', line 216 def initialize config @config = config @arr = Array.new #for keeping track of insertion order @set = Hash.new @self_links = Hash.new end |
Instance Method Details
#add(respObj) ⇒ Object
223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/nicinfo/common_json.rb', line 223 def add respObj if respObj.instance_of? Array respObj.each do |obj| add obj end else if !@set[ respObj.get_cn ] @set[ respObj.get_cn ] = respObj @arr << respObj self_link = NicInfo.get_self_link( NicInfo.get_links( respObj.objectclass, @config ) ) @self_links[ self_link ] = respObj if self_link end end end |
#associateEntities(entities) ⇒ Object
252 253 254 255 256 257 258 259 260 |
# File 'lib/nicinfo/common_json.rb', line 252 def associateEntities entities entities.each do |entity| associateEntities entity.entities if !entity.entities.empty? entity.asEvents.each do |asEvent| asEvent.entity_cn = entity.get_cn associateEventActor asEvent end end if entities end |
#associateEventActor(eventActor) ⇒ Object
244 245 246 247 248 249 250 |
# File 'lib/nicinfo/common_json.rb', line 244 def associateEventActor eventActor return if !eventActor or !eventActor. associate = @self_links[ eventActor. ] if associate associate.asEventActors << eventActor end end |
#display ⇒ Object
238 239 240 241 242 |
# File 'lib/nicinfo/common_json.rb', line 238 def display @arr.each do |object| object.display end end |