Class: Openra::Struct
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Openra::Struct
show all
- Defined in:
- lib/openra/struct.rb,
lib/openra/struct/client.rb,
lib/openra/struct/player.rb,
lib/openra/struct/metadata.rb,
lib/openra/struct/functions.rb,
lib/openra/struct/sync_info.rb,
lib/openra/struct/game_options.rb,
lib/openra/struct/pre_processor.rb,
lib/openra/struct/global_settings.rb,
lib/openra/struct/sync_lobby_clients.rb,
lib/openra/struct/game_options/string_option.rb,
lib/openra/struct/game_options/boolean_option.rb,
lib/openra/struct/game_options/integer_option.rb
Defined Under Namespace
Modules: Functions
Classes: Client, GameOptions, GlobalSettings, Metadata, Player, PreProcessor, SyncInfo, SyncLobbyClients
Constant Summary
collapse
- UNDEFINED =
Object.new.freeze
- DEFAULT_PROCESSOR =
PreProcessor.new
Class Method Summary
collapse
Class Method Details
.define(&block) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/openra/struct.rb', line 28
def define(&block)
instance_eval(&block)
preprocessor(preprocessor.with(**{ schema: schema }))
preprocessor.finalize!
end
|
.inherited(subclass) ⇒ Object
23
24
25
26
|
# File 'lib/openra/struct.rb', line 23
def inherited(subclass)
super
subclass.preprocessor(preprocessor)
end
|
.new(attributes) ⇒ Object
36
37
38
|
# File 'lib/openra/struct.rb', line 36
def new(attributes)
super(preprocessor.call(attributes))
end
|
.preprocessor(processor = UNDEFINED) ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/openra/struct.rb', line 15
def preprocessor(processor = UNDEFINED)
if processor === UNDEFINED
@__preprocessor || DEFAULT_PROCESSOR
else
@__preprocessor = processor
end
end
|