Class: ActionMCP::StringArray

Inherits:
ActiveModel::Type::Value
  • Object
show all
Defined in:
lib/action_mcp/string_array.rb

Overview

Custom type for handling arrays of strings in ActiveModel.

Instance Method Summary collapse

Instance Method Details

#cast(value) ⇒ Array<String>

Casts the given value to an array of strings.

Parameters:

  • value (Object)

    The value to cast.

Returns:

  • (Array<String>)

    The array of strings.



10
11
12
# File 'lib/action_mcp/string_array.rb', line 10

def cast(value)
  Array(value).map(&:to_s) # Ensure all elements are strings
end