Class: MessagePack::IDL::IR::Message
Direct Known Subclasses
Instance Attribute Summary collapse
-
#all_fields ⇒ Object
readonly
Returns the value of attribute all_fields.
-
#max_id ⇒ Object
readonly
Returns the value of attribute max_id.
-
#max_required_id ⇒ Object
readonly
Returns the value of attribute max_required_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#new_fields ⇒ Object
readonly
Returns the value of attribute new_fields.
-
#super_class ⇒ Object
readonly
Returns the value of attribute super_class.
Instance Method Summary collapse
- #[](id) ⇒ Object
-
#initialize(name, super_class, new_fields) ⇒ Message
constructor
A new instance of Message.
Methods inherited from Type
#list_type?, #map_type?, #nullable_type?, #parameterized_type?, #real_type, #void_type?
Constructor Details
#initialize(name, super_class, new_fields) ⇒ Message
Returns a new instance of Message.
260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/msgpack/idl/ir.rb', line 260 def initialize(name, super_class, new_fields) @name = name @super_class = super_class @new_fields = new_fields if super_class @all_fields = (super_class.all_fields + new_fields).sort_by {|f| f.id } else @all_fields = new_fields end @max_id = @all_fields.map {|f| f.id }.max || 0 @max_required_id = @all_fields.select {|f| f.required? }.map {|f| f.id }.max || 0 end |
Instance Attribute Details
#all_fields ⇒ Object (readonly)
Returns the value of attribute all_fields.
275 276 277 |
# File 'lib/msgpack/idl/ir.rb', line 275 def all_fields @all_fields end |
#max_id ⇒ Object (readonly)
Returns the value of attribute max_id.
275 276 277 |
# File 'lib/msgpack/idl/ir.rb', line 275 def max_id @max_id end |
#max_required_id ⇒ Object (readonly)
Returns the value of attribute max_required_id.
275 276 277 |
# File 'lib/msgpack/idl/ir.rb', line 275 def max_required_id @max_required_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
274 275 276 |
# File 'lib/msgpack/idl/ir.rb', line 274 def name @name end |
#new_fields ⇒ Object (readonly)
Returns the value of attribute new_fields.
274 275 276 |
# File 'lib/msgpack/idl/ir.rb', line 274 def new_fields @new_fields end |
#super_class ⇒ Object (readonly)
Returns the value of attribute super_class.
274 275 276 |
# File 'lib/msgpack/idl/ir.rb', line 274 def super_class @super_class end |
Instance Method Details
#[](id) ⇒ Object
277 278 279 |
# File 'lib/msgpack/idl/ir.rb', line 277 def [](id) @all_fields.find {|f| f.id == id } end |