Class: Tama::Neural::OperationParams
- Inherits:
-
Data
- Object
- Data
- Tama::Neural::OperationParams
- Defined in:
- lib/tama/neural/operation_params.rb
Instance Attribute Summary collapse
-
#chain_ids ⇒ Object
readonly
Returns the value of attribute chain_ids.
-
#node_type ⇒ Object
readonly
Returns the value of attribute node_type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(chain_ids:, node_type: nil) ⇒ OperationParams
constructor
A new instance of OperationParams.
- #to_h ⇒ Object
Constructor Details
#initialize(chain_ids:, node_type: nil) ⇒ OperationParams
Returns a new instance of OperationParams.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/tama/neural/operation_params.rb', line 6 def initialize(chain_ids:, node_type: nil) unless chain_ids.is_a?(Array) && !chain_ids.empty? && chain_ids.all? { |id| id.is_a?(String) && !id.empty? } raise Error::ValidationError.new("chain_ids must contain at least one chain ID", errors: {chain_ids: "must contain non-empty strings"}) end unless node_type.nil? || node_type.is_a?(String) raise Error::ValidationError.new("node_type must be a string", errors: {node_type: "must be a string"}) end super end |
Instance Attribute Details
#chain_ids ⇒ Object (readonly)
Returns the value of attribute chain_ids
5 6 7 |
# File 'lib/tama/neural/operation_params.rb', line 5 def chain_ids @chain_ids end |
#node_type ⇒ Object (readonly)
Returns the value of attribute node_type
5 6 7 |
# File 'lib/tama/neural/operation_params.rb', line 5 def node_type @node_type end |
Class Method Details
Instance Method Details
#to_h ⇒ Object
22 23 24 |
# File 'lib/tama/neural/operation_params.rb', line 22 def to_h {"chain_ids" => chain_ids}.tap { |body| body["node_type"] = node_type unless node_type.nil? } end |