Class: XamplGenerator::Element
- Inherits:
-
Object
- Object
- XamplGenerator::Element
show all
- Includes:
- Xampl::XamplObject, Xampl::XamplWithDataContent, AttributeAsChild, ChildElementAsChild
- Defined in:
- lib/xamplr-gen/xampl-generator.rb,
lib/xamplr-gen/xampl-hand-generated.rb
Constant Summary
collapse
- @@tag =
"element"
- @@ns =
"http://xampl.com/generator"
- @@ns_tag =
"{http://xampl.com/generator}element"
- @@module_name =
"XamplGenerator"
- @@attributes =
[
[ :@has_content, "hasContent" ],
[ :@class_name, "className" ],
[ :@attribute_name, "attributeName" ],
[ :@nstag, "nstag" ],
[ :@empty, "empty" ],
[ :@indexed_by_attr, "indexedByAttr" ],
[ :@persisted, "persisted" ],
[ :@name, "name" ],
[ :@kind, "kind" ],
[ :@namespace, "namespace" ],
[ :@package, "package" ],
]
Class Method Summary
collapse
Instance Method Summary
collapse
#add_attribute, #attribute_child, #attribute_child=, #ensure_attribute, #init_attribute_as_child, #new_attribute, #remove_attribute
#add_child_element, #child_element_child, #child_element_child=, #ensure_child_element, #init_child_element_as_child, #new_child_element, #remove_child_element
Constructor Details
#initialize(index = nil) {|_self| ... } ⇒ Element
Returns a new instance of Element.
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 743
def initialize(index=nil)
@name = index if index
super()
@has_content = nil if not defined? @has_content
@class_name = nil if not defined? @class_name
@attribute_name = nil if not defined? @attribute_name
@nstag = nil if not defined? @nstag
@empty = nil if not defined? @empty
@indexed_by_attr = nil if not defined? @indexed_by_attr
@persisted = nil if not defined? @persisted
@name = nil if not defined? @name
@kind = nil if not defined? @kind
@namespace = nil if not defined? @namespace
@package = nil if not defined? @package
init_xampl_object
init_data_content
init_child_element_as_child
init_attribute_as_child
yield(self) if block_given?
changed
end
|
Class Method Details
.module_name ⇒ Object
798
799
800
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 798
def Element.module_name
@@module_name
end
|
.ns ⇒ Object
790
791
792
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 790
def Element.ns
@@ns
end
|
.ns_tag ⇒ Object
794
795
796
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 794
def Element.ns_tag
@@ns_tag
end
|
.persisted? ⇒ Boolean
594
595
596
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 594
def Element.persisted?
false
end
|
.tag ⇒ Object
786
787
788
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 786
def Element.tag
@@tag
end
|
Instance Method Details
#after_visit(visitor) ⇒ Object
846
847
848
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 846
def after_visit(visitor)
visitor.after_visit_element(self)
end
|
#analyse(options) ⇒ Object
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
|
# File 'lib/xamplr-gen/xampl-generator.rb', line 455
def analyse(options)
is_empty, is_simple, is_data, is_mixed = false
class_name, attribute_name = Generator.choose_names(@name)
@class_name = class_name unless @class_name
@attribute_name = attribute_name unless @attribute_name
no_children = (0 == @child_element_child.size)
unless @kind then
if no_children then
is_simple = @has_content
is_empty = !is_simple
else
is_mixed = @has_content
is_data = !@has_content
end
if is_empty then
@kind = "empty"
elsif is_simple then
@kind = "simple"
elsif is_data then
@kind = "data"
elsif is_mixed then
@kind = "mixed"
else
throw "no kind determined" end
end
unless self.indexed_by_attr then
attribute_child.each do |attribute|
aname_orig = attribute.name
class_name, aname = Generator.choose_names(aname_orig)
attribute.name = aname
attribute.tag_name = aname_orig
options.index_attribute_child.each do |iattr|
if aname == iattr.name then
self.indexed_by_attr = aname
self.persisted = iattr.persisted
break
end
end
end
if self.persisted then
attribute = Attribute.new
attribute.name = 'scheduled_for_deletion_at'
attribute.tag_name = 'scheduled-for-deletion-at'
attribute.namespace = nil
self.add_attribute(attribute)
end
end
end
|
#append_to(other) ⇒ Object
782
783
784
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 782
def append_to(other)
other.add_element(self)
end
|
#attribute_name ⇒ Object
644
645
646
647
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 644
def attribute_name
accessed
@attribute_name
end
|
#attribute_name=(v) ⇒ Object
649
650
651
652
653
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 649
def attribute_name=(v)
accessed
changed
@attribute_name = v
end
|
#attributes ⇒ Object
818
819
820
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 818
def attributes
@@attributes
end
|
#before_visit(visitor) ⇒ Object
838
839
840
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 838
def before_visit(visitor)
visitor.before_visit_element(self)
end
|
#class_name ⇒ Object
633
634
635
636
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 633
def class_name
accessed
@class_name
end
|
#class_name=(v) ⇒ Object
638
639
640
641
642
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 638
def class_name=(v)
accessed
changed
@class_name = v
end
|
#clear_non_persistent_index_attributes ⇒ Object
768
769
770
771
772
773
774
775
776
777
778
779
780
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 768
def clear_non_persistent_index_attributes
@has_content = nil
@class_name = nil
@attribute_name = nil
@nstag = nil
@empty = nil
@indexed_by_attr = nil
@persisted = nil
@name = nil
@kind = nil
@namespace = nil
@package = nil
end
|
#empty ⇒ Object
666
667
668
669
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 666
def empty
accessed
@empty
end
|
#empty=(v) ⇒ Object
671
672
673
674
675
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 671
def empty=(v)
accessed
changed
@empty = v
end
|
#found_text_content ⇒ Object
451
452
453
|
# File 'lib/xamplr-gen/xampl-generator.rb', line 451
def found_text_content
self.has_content = true
end
|
#get_the_index ⇒ Object
826
827
828
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 826
def get_the_index
@name
end
|
#has_content ⇒ Object
622
623
624
625
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 622
def has_content
accessed
@has_content
end
|
#has_content=(v) ⇒ Object
627
628
629
630
631
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 627
def has_content=(v)
accessed
changed
@has_content = v
end
|
#indexed_by ⇒ Object
822
823
824
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 822
def indexed_by
:name
end
|
#indexed_by_attr ⇒ Object
677
678
679
680
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 677
def indexed_by_attr
accessed
@indexed_by_attr
end
|
#indexed_by_attr=(v) ⇒ Object
682
683
684
685
686
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 682
def indexed_by_attr=(v)
accessed
changed
@indexed_by_attr = v
end
|
#kind ⇒ Object
710
711
712
713
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 710
def kind
accessed
@kind
end
|
#kind=(v) ⇒ Object
715
716
717
718
719
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 715
def kind=(v)
accessed
changed
@kind = v
end
|
#module_name ⇒ Object
814
815
816
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 814
def module_name
@@module_name
end
|
#name ⇒ Object
699
700
701
702
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 699
def name
accessed
@name
end
|
#name=(v) ⇒ Object
704
705
706
707
708
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 704
def name=(v)
accessed
changed
@name = v
end
|
#namespace ⇒ Object
721
722
723
724
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 721
def namespace
accessed
@namespace
end
|
#namespace=(v) ⇒ Object
726
727
728
729
730
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 726
def namespace=(v)
accessed
changed
@namespace = v
end
|
#ns ⇒ Object
806
807
808
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 806
def ns
@@ns
end
|
#ns_tag ⇒ Object
810
811
812
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 810
def ns_tag
@@ns_tag
end
|
#nstag ⇒ Object
655
656
657
658
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 655
def nstag
accessed
@nstag
end
|
#nstag=(v) ⇒ Object
660
661
662
663
664
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 660
def nstag=(v)
accessed
changed
@nstag = v
end
|
#package ⇒ Object
732
733
734
735
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 732
def package
accessed
@package
end
|
#package=(v) ⇒ Object
737
738
739
740
741
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 737
def package=(v)
accessed
changed
@package = v
end
|
#persisted ⇒ Object
688
689
690
691
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 688
def persisted
accessed
@persisted
end
|
#persisted=(v) ⇒ Object
693
694
695
696
697
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 693
def persisted=(v)
accessed
changed
@persisted = v
end
|
#persisted? ⇒ Boolean
598
599
600
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 598
def persisted?
false
end
|
#set_the_index(index) ⇒ Object
830
831
832
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 830
def set_the_index(index)
@name = index
end
|
#substitute_in_visit(visitor) ⇒ Object
834
835
836
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 834
def substitute_in_visit(visitor)
return visitor.substitute_in_visit_element(self) || self
end
|
#tag ⇒ Object
802
803
804
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 802
def tag
@@tag
end
|
#visit(visitor) ⇒ Object
842
843
844
|
# File 'lib/xamplr-gen/xampl-hand-generated.rb', line 842
def visit(visitor)
visitor.visit_element(self)
end
|