Module: BinData::RegisterNamePlugin
- Included in:
- Base
- Defined in:
- lib/bindata/name.rb
Overview
Parameters
Parameters may be provided at initialisation to control the behaviour of an object. These parameters are:
:name
-
The name that this object can be referred to may be set explicitly. This is only useful when dynamically generating types. <code><pre>
BinData::Struct.new(name: :my_struct, fields: ...) array = BinData::Array.new(type: :my_struct)
</pre></code>
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
:nodoc:
16 17 18 19 |
# File 'lib/bindata/name.rb', line 16 def self.included(base) # :nodoc: # The registered name may be provided explicitly. base.optional_parameter :name end |
Instance Method Details
#initialize_shared_instance ⇒ Object
21 22 23 24 25 26 |
# File 'lib/bindata/name.rb', line 21 def initialize_shared_instance if has_parameter?(:name) RegisteredClasses.register(get_parameter(:name), self) end super end |