Class: XSD::CodeGen::MethodDef
- Includes:
- CommentDef, GenSupport
- Defined in:
- lib/xsd/codegen/methoddef.rb
Instance Attribute Summary collapse
-
#definition ⇒ Object
Returns the value of attribute definition.
Attributes included from CommentDef
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(name, *params) ⇒ MethodDef
constructor
A new instance of MethodDef.
Methods included from GenSupport
capitalize, constant?, #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 32 33 34 35 36 37 38 |
# File 'lib/xsd/codegen/methoddef.rb', line 23 def initialize(name, *params) klass, mname = name.split('.', 2) if mname.nil? mname, klass = klass, mname end unless safemethodname?(mname) raise ArgumentError.new("name '#{name}' seems to be unsafe") end if klass and klass != 'self' and !safeconstname(klass) 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
#definition ⇒ Object
Returns the value of attribute definition.
21 22 23 |
# File 'lib/xsd/codegen/methoddef.rb', line 21 def definition @definition end |
Instance Method Details
#dump ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/xsd/codegen/methoddef.rb', line 40 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 |