Sha256: 45cd40d059853d90f20104357677f99d661ab857ceff0de9d5db39c1d0d789a4

Contents?: true

Size: 297 Bytes

Versions: 9

Compression:

Stored size: 297 Bytes

Contents

# frozen_string_literal: true

class RubyStringCaster < Sinclair::Caster
  master_caster!

  cast_with(NilClass) { 'nil' }
  cast_with(Symbol) { |value| ":#{value}" }
  cast_with(String, :to_json)
  cast_with(Object, :to_s)

  def self.to_ruby_string(value)
    cast(value, value.class)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sinclair-2.1.1 spec/support/models/ruby_string_caster.rb
sinclair-2.1.0 spec/support/models/ruby_string_caster.rb
sinclair-2.0.1 spec/support/models/ruby_string_caster.rb
sinclair-2.0.0 spec/support/models/ruby_string_caster.rb
sinclair-1.16.3 spec/support/models/ruby_string_caster.rb
sinclair-1.16.2 spec/support/models/ruby_string_caster.rb
sinclair-1.16.1 spec/support/models/ruby_string_caster.rb
sinclair-1.16.0 spec/support/models/ruby_string_caster.rb
sinclair-1.15.0 spec/support/models/ruby_string_caster.rb