Class: XSD::CodeGen::MethodDef

Inherits:
Object
  • Object
show all
Includes:
CommentDef, GenSupport
Defined in:
lib/xsd/codegen/methoddef.rb

Instance Attribute Summary collapse

Attributes included from CommentDef

#comment

Instance Method Summary collapse

Methods included from GenSupport

#capitalize, #format, #keyword?, #safeconstname, #safeconstname?, #safemethodname, #safemethodname?, #safevarname, #safevarname?, #uncapitalize

Constructor Details

#initialize(name, *params) ⇒ MethodDef

Returns a new instance of MethodDef.



23
24
25
26
27
28
29
30
31
# File 'lib/xsd/codegen/methoddef.rb', line 23

def initialize(name, *params)
  unless safemethodname?(name)
    raise ArgumentError.new("name '#{name}' seems to be unsafe")
  end
  @name = name
  @params = params
  @comment = nil
  @definition = yield if block_given?
end

Instance Attribute Details

#definitionObject

Returns the value of attribute definition



21
22
23
# File 'lib/xsd/codegen/methoddef.rb', line 21

def definition
  @definition
end

Instance Method Details

#dumpObject



33
34
35
36
37
38
39
40
# File 'lib/xsd/codegen/methoddef.rb', line 33

def dump
  buf = ""
  buf << dump_comment if @comment
  buf << dump_method_def
  buf << dump_definition if @definition and !@definition.empty?
  buf << dump_method_def_end
  buf
end