Sha256: f8bcb0dd1ee5c1739da81120af06a602d6b6e44fe217bb81ba160cf685ac59d7

Contents?: true

Size: 756 Bytes

Versions: 6

Compression:

Stored size: 756 Bytes

Contents

require 'scaffold_parser/scaffolders/xsd/parser/handlers/utils'

module ScaffoldParser
  module Scaffolders
    class XSD
      class Parser
        class ModuleTemplate
          include Handlers::Utils

          attr_accessor :name, :methods, :namespaces

          def initialize(name = nil)
            @name = name
            @methods = []
            @namespaces = []

            yield self if block_given?
          end

          def to_s
            f = StringIO.new

            f.puts "module #{name}"
            f.puts methods.join("\n\n")

            f.puts "end"
            string = f.string.strip

            namespaces.inject(string) { |string, n| wrap_in_namespace(string, n) }
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
scaffold_parser-0.10.0 lib/scaffold_parser/scaffolders/xsd/parser/module_template.rb
scaffold_parser-0.9.1 lib/scaffold_parser/scaffolders/xsd/parser/module_template.rb
scaffold_parser-0.9.0 lib/scaffold_parser/scaffolders/xsd/parser/module_template.rb
scaffold_parser-0.8.0 lib/scaffold_parser/scaffolders/xsd/parser/module_template.rb
scaffold_parser-0.7.0 lib/scaffold_parser/scaffolders/xsd/parser/module_template.rb
scaffold_parser-0.6.0 lib/scaffold_parser/scaffolders/xsd/parser/module_template.rb