Module: XamplGenerator::IndexAttributeAsChild

Included in:
Options
Defined in:
lib/xamplr-gen/xampl-hand-generated.rb

Instance Method Summary collapse

Instance Method Details

#add_index_attribute(index_attribute) ⇒ Object



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 364

def add_index_attribute(index_attribute)
  accessed
  index = index_attribute.get_the_index
  if (nil == index) then
    throw "no value for the index 'name' of index_attribute defined in : " << index_attribute.pp_xml
  end

  existing = @index_attribute_child[index]

  self.remove_index_attribute(index) if existing and (existing != index_attribute)

  @children << index_attribute
  @index_attribute_child[index] = index_attribute

  index_attribute.add_parent(self)

  changed
  return index_attribute
end

#ensure_index_attribute(index) {|index_attribute| ... } ⇒ Object

Yields:



394
395
396
397
398
399
400
401
402
403
404
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 394

def ensure_index_attribute(index)
  accessed

  index_attribute = @index_attribute_child[index]
  return index_attribute if index_attribute

  index_attribute = IndexAttribute.new(index) unless index_attribute

  yield(index_attribute) if block_given?
  return add_index_attribute(index_attribute)
end

#index_attribute_childObject Also known as: index_attribute



347
348
349
350
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 347

def index_attribute_child
  accessed
  @index_attribute_child
end

#index_attribute_child=(v) ⇒ Object Also known as: index_attribute=



352
353
354
355
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 352

def index_attribute_child=(v)
  accessed
  @index_attribute_child = v
end

#init_index_attribute_as_childObject



360
361
362
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 360

def init_index_attribute_as_child
  @index_attribute_child = IndexedArray.new
end

#new_index_attribute(index) {|index_attribute| ... } ⇒ Object

Yields:



384
385
386
387
388
389
390
391
392
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 384

def new_index_attribute(index)
  accessed

  index_attribute = nil
  index_attribute = IndexAttribute.new(index) unless index_attribute

  yield(index_attribute) if block_given?
  return add_index_attribute(index_attribute)
end

#remove_index_attribute(index) ⇒ Object



406
407
408
409
410
411
412
413
414
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 406

def remove_index_attribute(index)
  accessed
  changed
  unless String === index or Symbol === index then
    index = index.get_the_index
  end
  index_attribute = @index_attribute_child.delete(index) if index
  @children.delete(index_attribute)
end