Class: ScaffoldParser::Scaffolders::XSD::Parser::Handlers::Extension

Inherits:
Object
  • Object
show all
Defined in:
lib/scaffold_parser/scaffolders/xsd/parser/handlers/extension.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elements = [], attributes) ⇒ Extension

Returns a new instance of Extension.



9
10
11
12
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/extension.rb', line 9

def initialize(elements = [], attributes)
  @elements = [*elements]
  @attributes = attributes
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



7
8
9
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/extension.rb', line 7

def attributes
  @attributes
end

#elementsObject

Returns the value of attribute elements.



7
8
9
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/extension.rb', line 7

def elements
  @elements
end

Instance Method Details

#complex_type(source) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/extension.rb', line 14

def complex_type(source)
  if source.has_name?
    template = Klass.new(source, elements) do |template|
      template.inherit_from = attributes['base'].camelize
    end

    STACK.push template
  else
    ComplexType.new elements + [ClassInherit.new(attributes['base'])]
  end
end