class Turbopuffer::Internal::Type::FileInput
def coerce(value, state:)
-
(StringIO, Object)
-
Options Hash:
(**state)
-
:branched
(Integer
) -- -
:error
(Class
) -- -
:exactness
(Hash{Symbol=>Object}
) -- -
:strictness
(Boolean
) -- -
:translate_names
(Boolean
) --
Parameters:
-
state
(Hash{Symbol=>Object}
) -- . -
value
(StringIO, String, Object
) --
Other tags:
- Api: - private
def coerce(value, state:) exactness = state.fetch(:exactness) case value in String exactness[:yes] += 1 StringIO.new(value) in StringIO exactness[:yes] += 1 value else state[:error] = TypeError.new("#{value.class} can't be coerced into #{StringIO}") exactness[:no] += 1 value end end