Class: Protomsg::MessageType
- Inherits:
-
Object
- Object
- Protomsg::MessageType
- Defined in:
- lib/protomsg/message_type.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type_number ⇒ Object
Returns the value of attribute type_number.
Instance Method Summary collapse
- #getters ⇒ Object
- #header ⇒ Object
-
#initialize(type_number, name, lines) ⇒ MessageType
constructor
A new instance of MessageType.
- #io ⇒ Object
- #lengths ⇒ Object
- #memory ⇒ Object
- #setters ⇒ Object
- #to_header_file ⇒ Object
- #variable_attributes ⇒ Object
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
#attributes ⇒ Object
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/protomsg/message_type.rb', line 3 def attributes @attributes end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/protomsg/message_type.rb', line 3 def name @name end |
#type_number ⇒ Object
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
#getters ⇒ Object
19 20 21 |
# File 'lib/protomsg/message_type.rb', line 19 def getters render_template('getters') end |
#header ⇒ Object
15 16 17 |
# File 'lib/protomsg/message_type.rb', line 15 def header render_template('header') end |
#io ⇒ Object
35 36 37 |
# File 'lib/protomsg/message_type.rb', line 35 def io render_template('io') end |
#lengths ⇒ Object
27 28 29 |
# File 'lib/protomsg/message_type.rb', line 27 def lengths render_template('lengths') end |
#memory ⇒ Object
31 32 33 |
# File 'lib/protomsg/message_type.rb', line 31 def memory render_template('memory') end |
#setters ⇒ Object
23 24 25 |
# File 'lib/protomsg/message_type.rb', line 23 def setters render_template('setters') end |
#to_header_file ⇒ Object
39 40 41 |
# File 'lib/protomsg/message_type.rb', line 39 def to_header_file render_template('message_type') end |
#variable_attributes ⇒ Object
11 12 13 |
# File 'lib/protomsg/message_type.rb', line 11 def variable_attributes @variable_attributes ||= @attributes.select(&:variable_length?) end |