Class: XamplGenerator::Elements

Inherits:
Object
  • Object
show all
Includes:
Xampl::XamplPersistedObject, Xampl::XamplWithDataContent, ElementAsChild
Defined in:
lib/xamplr/xampl-hand-generated.rb

Constant Summary collapse

@@tag =
"elements"
@@ns =
"http://xampl.com/generator"
@@ns_tag =
"{http://xampl.com/generator}elements"
@@module_name =
"XamplGenerator"
@@attributes =
[
        [ :@pid, "pid" ],
]

Instance Attribute Summary

Attributes included from Xampl::XamplPersistedObject

#load_needed, #persister

Attributes included from Xampl::XamplObject

#is_changed, #parents

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ElementAsChild

#add_element, #element_child, #element_child=, #ensure_element, #init_element_as_child, #new_element, #remove_element

Methods included from Xampl::XamplWithDataContent

#<<, #_content, #_content=, #add_content, #after_visit_by_element_kind, #before_visit_by_element_kind, #children, #has_mixed_content, #init_data_content, #test_to_xml, #test_to_xml_internal, #visit_by_element_kind

Methods included from Xampl::XamplPersistedObject

#accessed, #changed, #describe_yourself, #force_load, #init_xampl_object, #introduce_persister, #persist_required, #reset_contents

Methods included from Xampl::XamplObject

#===, #accessed, #add_parent, #changed, #changes_accepted, #compare_xampl, #copy_xampl, from_ruby, from_string, from_xml_file, from_xml_string, #ignore_when_no_index, #init_attributes, #init_hook, #init_xampl_object, #invalid, #invalidate, lookup_preferred_ns_prefix, #mark_changed_deep, #note_add_child, #note_add_to_parent, #note_adding_text_content, #note_attributes_initialised, #note_closed, #note_created, #note_initialise_attributes_with, #note_invalidate, #note_replacing, ns_preferred_prefix, #persist, #persist_required, #pp_xml, realise_from_xml_string, recover_from_string, #to_ruby, #to_xml

Constructor Details

#initialize(index = nil) {|_self| ... } ⇒ Elements

Returns a new instance of Elements.

Yields:

  • (_self)

Yield Parameters:



503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/xamplr/xampl-hand-generated.rb', line 503

def initialize(index=nil)
  @pid = index if index
  super()

  @pid = nil if not defined? @pid

  init_xampl_object
  init_data_content
  init_element_as_child

  yield(self) if block_given?
  changed
end

Class Method Details

.[](pid) ⇒ Object



486
487
488
# File 'lib/xamplr/xampl-hand-generated.rb', line 486

def Elements.[](pid)
  Xampl.lookup(Elements, pid)
end

.lookup(pid) ⇒ Object



482
483
484
# File 'lib/xamplr/xampl-hand-generated.rb', line 482

def Elements.lookup(pid)
  Xampl.lookup(Elements, pid)
end

.module_nameObject



536
537
538
# File 'lib/xamplr/xampl-hand-generated.rb', line 536

def Elements.module_name
  @@module_name
end

.nsObject



528
529
530
# File 'lib/xamplr/xampl-hand-generated.rb', line 528

def Elements.ns
  @@ns
end

.ns_tagObject



532
533
534
# File 'lib/xamplr/xampl-hand-generated.rb', line 532

def Elements.ns_tag
  @@ns_tag
end

.persisted?Boolean

Returns:

  • (Boolean)


465
466
467
# File 'lib/xamplr/xampl-hand-generated.rb', line 465

def Elements.persisted?
  false
end

.tagObject



524
525
526
# File 'lib/xamplr/xampl-hand-generated.rb', line 524

def Elements.tag
  @@tag
end

Instance Method Details

#after_visit(visitor) ⇒ Object



584
585
586
# File 'lib/xamplr/xampl-hand-generated.rb', line 584

def after_visit(visitor)
  visitor.after_visit_elements(self)
end

#append_to(other) ⇒ Object



520
521
522
# File 'lib/xamplr/xampl-hand-generated.rb', line 520

def append_to(other)
  other.add_elements(self)
end

#attributesObject



556
557
558
# File 'lib/xamplr/xampl-hand-generated.rb', line 556

def attributes
  @@attributes
end

#before_visit(visitor) ⇒ Object



576
577
578
# File 'lib/xamplr/xampl-hand-generated.rb', line 576

def before_visit(visitor)
  visitor.before_visit_elements(self)
end

#clear_non_persistent_index_attributesObject



517
518
# File 'lib/xamplr/xampl-hand-generated.rb', line 517

def clear_non_persistent_index_attributes
end

#get_the_indexObject



564
565
566
# File 'lib/xamplr/xampl-hand-generated.rb', line 564

def get_the_index
  @pid
end

#indexed_byObject



560
561
562
# File 'lib/xamplr/xampl-hand-generated.rb', line 560

def indexed_by
  :pid
end

#module_nameObject



552
553
554
# File 'lib/xamplr/xampl-hand-generated.rb', line 552

def module_name
  @@module_name
end

#nsObject



544
545
546
# File 'lib/xamplr/xampl-hand-generated.rb', line 544

def ns
  @@ns
end

#ns_tagObject



548
549
550
# File 'lib/xamplr/xampl-hand-generated.rb', line 548

def ns_tag
  @@ns_tag
end

#persisted?Boolean

Returns:

  • (Boolean)


469
470
471
# File 'lib/xamplr/xampl-hand-generated.rb', line 469

def persisted?
  false
end

#pidObject



490
491
492
# File 'lib/xamplr/xampl-hand-generated.rb', line 490

def pid
  @pid
end

#pid=(v) ⇒ Object



494
495
496
497
498
499
500
501
# File 'lib/xamplr/xampl-hand-generated.rb', line 494

def pid=(v)
  accessed
  # This is kind of optimistic, I think you are in trouble if you do this
  Xampl.auto_uncache(self) if @pid
  @pid = v
  changed
  Xampl.auto_cache(self) if v
end

#set_the_index(index) ⇒ Object



568
569
570
# File 'lib/xamplr/xampl-hand-generated.rb', line 568

def set_the_index(index)
  @pid = index
end

#substitute_in_visit(visitor) ⇒ Object



572
573
574
# File 'lib/xamplr/xampl-hand-generated.rb', line 572

def substitute_in_visit(visitor)
  return visitor.substitute_in_visit_elements(self) || self
end

#tagObject



540
541
542
# File 'lib/xamplr/xampl-hand-generated.rb', line 540

def tag
  @@tag
end

#visit(visitor) ⇒ Object



580
581
582
# File 'lib/xamplr/xampl-hand-generated.rb', line 580

def visit(visitor)
  visitor.visit_elements(self)
end