Extended maintenance of Ruby versions 1.8.7 and 1.9.2 will end on July 31, 2014. Read more

In Files

  • xsd/codegen/classdef.rb

Parent

Included Modules

Class/Module Index [+]

Quicksearch

XSD::CodeGen::ClassDef

Public Class Methods

new(name, baseclass = nil) click to toggle source
 
               # File xsd/codegen/classdef.rb, line 21
def initialize(name, baseclass = nil)
  super(name)
  @baseclass = baseclass
  @classvar = []
  @attrdef = []
end
            

Public Instance Methods

def_attr(attrname, writable = true, varname = nil) click to toggle source
 
               # File xsd/codegen/classdef.rb, line 36
def def_attr(attrname, writable = true, varname = nil)
  unless safevarname?(varname || attrname)
    raise ArgumentError.new("#{varname || attrname} seems to be unsafe")
  end
  @attrdef << [attrname, writable, varname]
end
            
def_classvar(var, value) click to toggle source
 
               # File xsd/codegen/classdef.rb, line 28
def def_classvar(var, value)
  var = var.sub(/\A@@/, "")
  unless safevarname?(var)
    raise ArgumentError.new("#{var} seems to be unsafe")
  end
  @classvar << [var, value]
end
            
dump() click to toggle source
 
               # File xsd/codegen/classdef.rb, line 43
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_class_def
  spacer = false
  unless @classvar.empty?
    spacer = true
    buf << dump_classvar
  end
  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 @attrdef.empty?
    buf << dump_emptyline if spacer
    spacer = true
    buf << dump_attributes
  end
  unless @methoddef.empty?
    buf << dump_emptyline if spacer
    spacer = true
    buf << dump_methods
  end
  buf << dump_class_def_end
  buf << dump_package_def_end(package) unless package.empty?
  buf.gsub(/^\s+$/, '')
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus