Sha256: 697862f6b1deb05e29b1034a697ca662afc639ae9d16622f14c8bc94c52b6b7e

Contents?: true

Size: 664 Bytes

Versions: 17

Compression:

Stored size: 664 Bytes

Contents

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

if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.4.0')
  [Bignum, Fixnum].each do |klass|
    klass.send(:define_method, :react_serializer) do
      as_json
    end
  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

17 entries across 17 versions & 2 rubygems

Version Path
hyper-component-1.0.alpha1.8 lib/hyperstack/ext/component/serializers.rb
hyper-component-1.0.alpha1.7 lib/hyperstack/ext/component/serializers.rb
hyper-component-1.0.alpha1.6 lib/hyperstack/ext/component/serializers.rb
hyper-component-1.0.alpha1.5 lib/hyperstack/ext/component/serializers.rb
hyper-component-1.0.alpha1.4 lib/hyperstack/ext/component/serializers.rb
hyper-component-0.99.6 lib/reactive-ruby/serializers.rb
hyper-component-1.0.alpha1.3 lib/hyperstack/ext/component/serializers.rb
hyper-component-0.99.5 lib/reactive-ruby/serializers.rb
hyper-component-0.99.4 lib/reactive-ruby/serializers.rb
hyper-component-1.0.alpha1.2 lib/hyperstack/ext/component/serializers.rb
hyper-component-1.0.alpha1.1 lib/hyperstack/ext/component/serializers.rb
hyper-component-1.0.alpha1 lib/hyperstack/ext/component/serializers.rb
hyper-component-0.99.3 lib/reactive-ruby/serializers.rb
hyper-component-0.99.2 lib/reactive-ruby/serializers.rb
hyper-component-0.99.1 lib/reactive-ruby/serializers.rb
hyper-component-0.99.0 lib/reactive-ruby/serializers.rb
hyper-react-1.0.0.lap28 lib/reactive-ruby/serializers.rb