Method: Highway::Steps::Types::String#typecheck
- Defined in:
- lib/highway/steps/types/string.rb
permalink #typecheck(value) ⇒ String?
Typecheck and coerce a value if possible.
This method returns a typechecked and coerced value or ‘nil` if value has invalid type and can’t be coerced.
34 35 36 37 38 39 40 41 |
# File 'lib/highway/steps/types/string.rb', line 34 def typecheck(value) case value when ::String then value when ::Numeric then value.to_s when ::TrueClass then "true" when ::FalseClass then "false" end end |