Class: Duxml::ChildrenRuleClass
- Inherits:
-
RuleClass
- Object
- PatternClass
- RuleClass
- Duxml::ChildrenRuleClass
- Includes:
- ChildrenRule, RngChildrenRule
- Defined in:
- lib/duxml/meta/grammar/rule/children_rule.rb,
lib/duxml/meta/grammar/relax_ng/children_rule.rb
Overview
do not subclass! rule that states what children and how many a given element is allowed to have where @statement is a DTD/Regexp of what children are allowed, how many, in what order and whether they are required
Instance Attribute Summary
Attributes inherited from RuleClass
Attributes included from Reportable
Attributes inherited from PatternClass
Attributes included from Duxml
Attributes included from Saxer
Instance Method Summary collapse
-
#initialize(_subject, _statement) ⇒ ChildrenRuleClass
constructor
child rules are initialized from DTD doc declarations e.g.
Methods included from RngChildrenRule
Methods included from LazyOx
Methods included from ChildrenRule
#applies_to?, #qualify, #required_children
Methods included from Rule
#applies_to?, #description, #history, #qualify
Methods included from Reportable
Methods included from Pattern
#<=>, #abstract?, #concrete?, #description, #name, #object, #relationship, #simple_name, #xml
Methods included from Duxml
Methods included from Saxer
Constructor Details
#initialize(_subject, _statement) ⇒ ChildrenRuleClass
child rules are initialized from DTD doc declarations e.g. (zeroOrMore|other-first-child)*,second-child-optional?,third-child-gt1+
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/duxml/meta/grammar/rule/children_rule.rb', line 18 def initialize(_subject, _statement) formatted_statement = _statement .gsub(/[\<>]/, '') .gsub(/#PCDATA/, 'PCDATA') .gsub('-','_dash_') .gsub(/\b/,'\b') .gsub(/PCDATA/, '#PCDATA') .gsub('_dash_', '-') .gsub(/\s/,'') super(_subject, formatted_statement) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Duxml::LazyOx