Class: ScaffoldParser::Scaffolders::XSD::Parser::Handlers::ModuleInclude

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ ModuleInclude

Returns a new instance of ModuleInclude.



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

def initialize(source)
  @source = source
  @ref = @source.ref&.camelize
end

Instance Attribute Details

#refObject (readonly)

Returns the value of attribute ref.



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

def ref
  @ref
end

#sourceObject (readonly)

Returns the value of attribute source.



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

def source
  @source
end

Instance Method Details

#complex_type(new_source) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/module_include.rb', line 26

def complex_type(new_source)
  if new_source.has_name?
    STACK.push Klass.new(new_source, self)
  else
    self
  end
end

#element(new_source) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/module_include.rb', line 34

def element(new_source)
  if new_source.has_name?
    new_class = STACK.push Klass.new(new_source, self)

    SubmodelMethod.new(new_source, new_class.name_with_prefix)
  end
end

#full_refObject



14
15
16
17
18
19
20
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/module_include.rb', line 14

def full_ref
  if ref.include? ':'
    [ref.split(':')[0], 'groups', ref.split(':')[1]].compact.map(&:camelize).join('::')
  else
    [source.xmlns_prefix, 'groups', ref].compact.map(&:camelize).join('::')
  end
end

#sequence(_) ⇒ Object



22
23
24
# File 'lib/scaffold_parser/scaffolders/xsd/parser/handlers/module_include.rb', line 22

def sequence(_)
  Sequence.new self
end