Module: XamplGenerator::IndexAttributeAsChild
- Included in:
- Options
- Defined in:
- lib/xamplr/xampl-hand-generated.rb
Instance Method Summary collapse
- #add_index_attribute(index_attribute) ⇒ Object
- #ensure_index_attribute(index) {|index_attribute| ... } ⇒ Object
- #index_attribute_child ⇒ Object (also: #index_attribute)
- #index_attribute_child=(v) ⇒ Object (also: #index_attribute=)
- #init_index_attribute_as_child ⇒ Object
- #new_index_attribute(index) {|index_attribute| ... } ⇒ Object
- #remove_index_attribute(index) ⇒ Object
Instance Method Details
#add_index_attribute(index_attribute) ⇒ Object
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/xamplr/xampl-hand-generated.rb', line 365 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
395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/xamplr/xampl-hand-generated.rb', line 395 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_child ⇒ Object Also known as: index_attribute
348 349 350 351 |
# File 'lib/xamplr/xampl-hand-generated.rb', line 348 def index_attribute_child accessed @index_attribute_child end |
#index_attribute_child=(v) ⇒ Object Also known as: index_attribute=
353 354 355 356 |
# File 'lib/xamplr/xampl-hand-generated.rb', line 353 def index_attribute_child=(v) accessed @index_attribute_child = v end |
#init_index_attribute_as_child ⇒ Object
361 362 363 |
# File 'lib/xamplr/xampl-hand-generated.rb', line 361 def init_index_attribute_as_child @index_attribute_child = IndexedArray.new end |
#new_index_attribute(index) {|index_attribute| ... } ⇒ Object
385 386 387 388 389 390 391 392 393 |
# File 'lib/xamplr/xampl-hand-generated.rb', line 385 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
407 408 409 410 411 412 413 414 415 |
# File 'lib/xamplr/xampl-hand-generated.rb', line 407 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 |