Class: MessagePack::IDL::AST::Enum

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, fields) ⇒ Enum

Returns a new instance of Enum.



127
128
129
130
# File 'lib/msgpack/idl/ast.rb', line 127

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

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



131
132
133
# File 'lib/msgpack/idl/ast.rb', line 131

def fields
  @fields
end

#nameObject (readonly)

Returns the value of attribute name.



131
132
133
# File 'lib/msgpack/idl/ast.rb', line 131

def name
  @name
end

Instance Method Details

#textObject



133
134
135
136
137
138
# File 'lib/msgpack/idl/ast.rb', line 133

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