Sha256: d89b15d6c24105e6bf048d349d3f294837acfd110b9e950b0e7dfe9ba068f6ba

Contents?: true

Size: 499 Bytes

Versions: 64

Compression:

Stored size: 499 Bytes

Contents

[Bignum, FalseClass, Fixnum, Float, Integer, NilClass, String, Symbol, Time, TrueClass].each do |klass|
  klass.send(:define_method, :react_serializer) do 
    as_json
  end
end

BigDecimal.send(:define_method, :react_serializer) { as_json } rescue nil

Array.send(:define_method, :react_serializer) do 
  self.collect { |e| e.react_serializer }.as_json
end

Hash.send(:define_method, :react_serializer) do
  Hash[*self.collect { |key, value| [key, value.react_serializer] }.flatten(1)].as_json
end

Version data entries

64 entries across 64 versions & 3 rubygems

Version Path
reactive-ruby-0.7.6 lib/reactive-ruby/serializers.rb
reactive-ruby-0.7.5 lib/reactive-ruby/serializers.rb
reactive-ruby-0.7.4 lib/reactive-ruby/serializers.rb
reactive-ruby-0.7.3 lib/reactive-ruby/serializers.rb