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
hyper-react-1.0.0.lap27 lib/reactive-ruby/serializers.rb
hyper-react-1.0.0.lap26 lib/reactive-ruby/serializers.rb
hyper-react-1.0.0.lap25 lib/reactive-ruby/serializers.rb
hyper-react-1.0.0.lap24 lib/reactive-ruby/serializers.rb
hyper-react-1.0.0.lap23 lib/reactive-ruby/serializers.rb
hyper-react-1.0.0.lap22 lib/reactive-ruby/serializers.rb
hyper-react-1.0.0.lap21 lib/reactive-ruby/serializers.rb
hyper-react-0.12.7 lib/reactive-ruby/serializers.rb
hyper-react-0.12.6 lib/reactive-ruby/serializers.rb
hyper-react-0.12.5 lib/reactive-ruby/serializers.rb
hyper-react-0.12.4 lib/reactive-ruby/serializers.rb
hyper-react-0.12.3 lib/reactive-ruby/serializers.rb
hyper-react-0.12.2 lib/reactive-ruby/serializers.rb
hyper-react-0.12.1 lib/reactive-ruby/serializers.rb
hyper-react-0.12.0 lib/reactive-ruby/serializers.rb
hyper-react-0.11.0 lib/reactive-ruby/serializers.rb
hyper-react-0.10.0 lib/reactive-ruby/serializers.rb
reactrb-0.9.0 lib/reactive-ruby/serializers.rb
reactrb-0.8.8 lib/reactive-ruby/serializers.rb
reactrb-0.8.7 lib/reactive-ruby/serializers.rb