Class: DtoHelper
- Inherits:
-
Object
- Object
- DtoHelper
- Defined in:
- lib/hypertube-ruby-sdk/sdk/tools/dto_helper.rb
Overview
Helper class for working with Data Transfer Objects (DTOs) in RuntimeBridge. Provides utility methods for accessing and managing DTO field values.
Class Method Summary collapse
-
.try_get_dto_field_value(command, field_name) ⇒ Object
Attempts to retrieve a DTO field value by field name from a command chain.
Class Method Details
.try_get_dto_field_value(command, field_name) ⇒ Object
Attempts to retrieve a DTO field value by field name from a command chain.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/hypertube-ruby-sdk/sdk/tools/dto_helper.rb', line 15 def try_get_dto_field_value(command, field_name) current_command = command while current_command if current_command.command_type == CommandType::SET_INSTANCE_FIELD && try_get_dto_field_name?(current_command) && get_dto_field_name(current_command) == field_name return try_get_dto_field_value_from_command(current_command) end payload = current_command.payload break if payload.nil? || payload.empty? first_payload = payload[0] current_command = first_payload.is_a?(Command) ? first_payload : nil end return nil end |