Class: MessagePack::IDL::AST::Message

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

Direct Known Subclasses

Exception

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Element

#summary

Constructor Details

#initialize(name, super_class, fields) ⇒ Message

Returns a new instance of Message.



73
74
75
76
77
# File 'lib/msgpack/idl/ast.rb', line 73

def initialize(name, super_class, fields)
	@name = name
	@super_class = super_class
	@fields = fields
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



78
79
80
# File 'lib/msgpack/idl/ast.rb', line 78

def fields
  @fields
end

#nameObject (readonly)

Returns the value of attribute name.



78
79
80
# File 'lib/msgpack/idl/ast.rb', line 78

def name
  @name
end

#super_classObject (readonly)

Returns the value of attribute super_class.



78
79
80
# File 'lib/msgpack/idl/ast.rb', line 78

def super_class
  @super_class
end

Instance Method Details

#textObject



80
81
82
83
84
85
86
87
# File 'lib/msgpack/idl/ast.rb', line 80

def text
	t = "message #{@name}"
	t << " < #{@super_class.text}" if @super_class
	t << " {\n"
	t << @fields.map {|f| "    #{f.text}\n" }.join
	t << "}"
	t
end