Class: Soybean::Generators::MappingGenerator::ModuleDef
- Inherits:
-
XSD::CodeGen::ModuleDef
- Object
- XSD::CodeGen::ModuleDef
- Soybean::Generators::MappingGenerator::ModuleDef
- Defined in:
- lib/soybean/generators/mapping_generator.rb
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(name, modules = []) ⇒ ModuleDef
constructor
A new instance of ModuleDef.
Constructor Details
#initialize(name, modules = []) ⇒ ModuleDef
Returns a new instance of ModuleDef.
81 82 83 84 |
# File 'lib/soybean/generators/mapping_generator.rb', line 81 def initialize(name, modules = []) super(name) @innermodule = modules end |
Instance Method Details
#dump ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/soybean/generators/mapping_generator.rb', line 86 def dump buf = "" unless @requirepath.empty? buf << dump_requirepath end buf << dump_emptyline unless buf.empty? package = @name.split(/::/)[0..-2] buf << dump_package_def(package) unless package.empty? buf << dump_comment if @comment buf << dump_module_def spacer = false unless @const.empty? buf << dump_emptyline if spacer spacer = true buf << dump_const end unless @code.empty? buf << dump_emptyline if spacer spacer = true buf << dump_code end unless @innermodule.empty? buf << dump_emptyline # always add 1 empty line spacer = true buf << dump_innermodule end unless @methoddef.empty? buf << dump_emptyline if spacer spacer = true buf << dump_methods end buf << dump_module_def_end buf << dump_package_def_end(package) unless package.empty? buf.gsub(/^\s+$/, '') end |