Sha256: 7eda4c083d9bb6292a1b0f610e7b694debe1c9bbad5caa6d2e8f547819499b1f

Contents?: true

Size: 367 Bytes

Versions: 3

Compression:

Stored size: 367 Bytes

Contents

class Taro::Types::Scalar::StringType < Taro::Types::ScalarType
  self.openapi_type = :string

  def coerce_input
    object.instance_of?(String) ? object : input_error('must be a String')
  end

  def coerce_response
    case object
    when String then object
    when Symbol then object.to_s
    else response_error('must be a String or Symbol')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
taro-1.2.0 lib/taro/types/scalar/string_type.rb
taro-1.1.0 lib/taro/types/scalar/string_type.rb
taro-1.0.0 lib/taro/types/scalar/string_type.rb