Class: MessagePack::IDL::AST::Func

Inherits:
Element
  • Object
show all
Defined in:
lib/msgpack/idl/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Element

#summary

Constructor Details

#initialize(name, return_type, args, exceptions) ⇒ Func

Returns a new instance of Func.



209
210
211
212
213
214
# File 'lib/msgpack/idl/ast.rb', line 209

def initialize(name, return_type, args, exceptions)
	@name = name
	@return_type = return_type
	@args = args
	@exceptions = exceptions
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



215
216
217
# File 'lib/msgpack/idl/ast.rb', line 215

def args
  @args
end

#exceptionsObject (readonly)

Returns the value of attribute exceptions.



215
216
217
# File 'lib/msgpack/idl/ast.rb', line 215

def exceptions
  @exceptions
end

#nameObject (readonly)

Returns the value of attribute name.



215
216
217
# File 'lib/msgpack/idl/ast.rb', line 215

def name
  @name
end

#return_typeObject (readonly)

Returns the value of attribute return_type.



215
216
217
# File 'lib/msgpack/idl/ast.rb', line 215

def return_type
  @return_type
end

Instance Method Details

#textObject



217
218
219
220
221
# File 'lib/msgpack/idl/ast.rb', line 217

def text
	t = "#{@return_type.text} #{@name}(#{@args.map {|a| a.text }.join(', ')})"
	t << " throws #{@exceptions.map {|ex| ex.text }.join(', ')}" if @exceptions && !@exceptions.empty?
	t
end