Class: DirectionDef

Inherits:
Def
  • Object
show all
Defined in:
lib/runtime.rb,
lib/generators/unity_client_generator.rb

Instance Attribute Summary collapse

Attributes inherited from Def

#ast

Instance Method Summary collapse

Constructor Details

#initialize(ast, client, server) ⇒ DirectionDef

Returns a new instance of DirectionDef.



115
116
117
118
119
120
121
122
# File 'lib/runtime.rb', line 115

def initialize ast, client, server
	super ast
	@client = client
	@direction = ast.direction
	@server = server
	@messages = {}
	@doc = ast.doc
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



113
114
115
# File 'lib/runtime.rb', line 113

def client
  @client
end

#directionObject (readonly)

Returns the value of attribute direction.



113
114
115
# File 'lib/runtime.rb', line 113

def direction
  @direction
end

#docObject (readonly)

Returns the value of attribute doc.



113
114
115
# File 'lib/runtime.rb', line 113

def doc
  @doc
end

#messagesObject (readonly)

Returns the value of attribute messages.



113
114
115
# File 'lib/runtime.rb', line 113

def messages
  @messages
end

#serverObject (readonly)

Returns the value of attribute server.



113
114
115
# File 'lib/runtime.rb', line 113

def server
  @server
end

Instance Method Details

#add_message(message_def) ⇒ Object



133
134
135
# File 'lib/runtime.rb', line 133

def add_message message_def
	@messages[message_def.name] = message_def
end

#nameObject



124
125
126
127
128
129
130
131
# File 'lib/runtime.rb', line 124

def name
	case @direction
	when :left
		return "#{@client.name} <- #{@server.name}"
	when :right
		return "#{@client.name} -> #{@server.name}"
	end
end

#unity_nameObject



147
148
149
# File 'lib/generators/unity_client_generator.rb', line 147

def unity_name
	"#{@client}#{@server}Connector"
end