Class: ScaffoldParser::Scaffolders::XSD::Parser
- Inherits:
-
Object
- Object
- ScaffoldParser::Scaffolders::XSD::Parser
- Defined in:
- lib/scaffold_parser/scaffolders/xsd/parser.rb,
lib/scaffold_parser/scaffolders/xsd/parser/stack.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/all.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/blank.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/klass.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/utils.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/choice.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/import.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/module.rb,
lib/scaffold_parser/scaffolders/xsd/parser/module_template.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/include.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/elements.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/sequence.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/at_method.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/extension.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/base_method.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/element_ref.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/list_method.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/complex_type.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/class_inherit.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/module_include.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/order_elements.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/submodel_method.rb,
lib/scaffold_parser/scaffolders/xsd/parser/handlers/proxy_list_method.rb
Defined Under Namespace
Modules: Handlers Classes: ModuleTemplate, Stack
Constant Summary collapse
- STACK =
Stack.instance
Instance Attribute Summary collapse
-
#xsds ⇒ Object
readonly
Returns the value of attribute xsds.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(xsds, options) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize(xsds, options) ⇒ Parser
Returns a new instance of Parser.
14 15 16 17 |
# File 'lib/scaffold_parser/scaffolders/xsd/parser.rb', line 14 def initialize(xsds, ) @xsds = xsds @options = end |
Instance Attribute Details
#xsds ⇒ Object (readonly)
Returns the value of attribute xsds.
8 9 10 |
# File 'lib/scaffold_parser/scaffolders/xsd/parser.rb', line 8 def xsds @xsds end |
Class Method Details
.call(xsds, options) ⇒ Object
10 11 12 |
# File 'lib/scaffold_parser/scaffolders/xsd/parser.rb', line 10 def self.call(xsds, ) self.new(xsds, ).call end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/scaffold_parser/scaffolders/xsd/parser.rb', line 21 def call STACK.clear xsds.each do |xsd| xsd.reverse_traverse do |element, children_result| handler = if children_result.empty? Handlers::Blank.new elsif children_result.one? children_result.first else Handlers::Elements.new(children_result) end handler.send(element.element_name, element) rescue p "Something happened during processing schema #{xsd.source} and node #{element.css_path}" raise end end STACK.to_a end |