Class: MessagePack::IDL::AST::Field

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

Direct Known Subclasses

ValueAssignedField

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Element

#summary

Constructor Details

#initialize(id, type, modifier, name) ⇒ Field

Returns a new instance of Field.



96
97
98
99
100
101
# File 'lib/msgpack/idl/ast.rb', line 96

def initialize(id, type, modifier, name)
	@id = id
	@type = type
	@name = name
	@modifier = modifier
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



102
103
104
# File 'lib/msgpack/idl/ast.rb', line 102

def id
  @id
end

#modifierObject (readonly)

Returns the value of attribute modifier.



102
103
104
# File 'lib/msgpack/idl/ast.rb', line 102

def modifier
  @modifier
end

#nameObject (readonly)

Returns the value of attribute name.



102
103
104
# File 'lib/msgpack/idl/ast.rb', line 102

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



102
103
104
# File 'lib/msgpack/idl/ast.rb', line 102

def type
  @type
end

Instance Method Details

#textObject



104
105
106
107
108
109
110
# File 'lib/msgpack/idl/ast.rb', line 104

def text
	if @modifier == FIELD_OPTIONAL
		"#{@id}: optional #{@type.text} #{@name}"
	else
		"#{@id}: #{@type.text} #{@name}"
	end
end