Class: MessagePack::IDL::AST::Service

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, version, functions) ⇒ Service



155
156
157
158
159
# File 'lib/msgpack/idl/ast.rb', line 155

def initialize(name, version, functions)
  @name = name
  @version = version
  @functions = functions
end

Instance Attribute Details

#functionsObject (readonly)

Returns the value of attribute functions.



160
161
162
# File 'lib/msgpack/idl/ast.rb', line 160

def functions
  @functions
end

#nameObject (readonly)

Returns the value of attribute name.



160
161
162
# File 'lib/msgpack/idl/ast.rb', line 160

def name
  @name
end

#versionObject (readonly)

Returns the value of attribute version.



160
161
162
# File 'lib/msgpack/idl/ast.rb', line 160

def version
  @version
end

Instance Method Details

#textObject



162
163
164
165
166
167
168
169
# File 'lib/msgpack/idl/ast.rb', line 162

def text
  t = "service #{@name}"
  t << ":#{@version}" if @version
  t << " {\n"
  t << @functions.map {|f| "    #{f.text}\n" }.join
  t << "}"
  t
end