Class: Protomsg::MessageType

Inherits:
Object
  • Object
show all
Defined in:
lib/protomsg/message_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type_number, name, lines) ⇒ MessageType

Returns a new instance of MessageType.



4
5
6
7
8
9
# File 'lib/protomsg/message_type.rb', line 4

def initialize(type_number, name, lines)
  @name         = name
  @type_number  = type_number
  lines = lines.split("\n").collect(&:strip).reject(&:empty?)
  @attributes   = lines.collect {|line| Attribute.new(self, line)}
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



3
4
5
# File 'lib/protomsg/message_type.rb', line 3

def attributes
  @attributes
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/protomsg/message_type.rb', line 3

def name
  @name
end

#type_numberObject

Returns the value of attribute type_number.



3
4
5
# File 'lib/protomsg/message_type.rb', line 3

def type_number
  @type_number
end

Instance Method Details

#gettersObject



19
20
21
# File 'lib/protomsg/message_type.rb', line 19

def getters
  render_template('getters')
end

#headerObject



15
16
17
# File 'lib/protomsg/message_type.rb', line 15

def header
  render_template('header')
end

#ioObject



35
36
37
# File 'lib/protomsg/message_type.rb', line 35

def io
  render_template('io')
end

#lengthsObject



27
28
29
# File 'lib/protomsg/message_type.rb', line 27

def lengths
  render_template('lengths')
end

#memoryObject



31
32
33
# File 'lib/protomsg/message_type.rb', line 31

def memory
  render_template('memory')
end

#settersObject



23
24
25
# File 'lib/protomsg/message_type.rb', line 23

def setters
  render_template('setters')
end

#to_header_fileObject



39
40
41
# File 'lib/protomsg/message_type.rb', line 39

def to_header_file
  render_template('message_type')
end

#variable_attributesObject



11
12
13
# File 'lib/protomsg/message_type.rb', line 11

def variable_attributes
  @variable_attributes ||= @attributes.select(&:variable_length?)
end