simple-serializer 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/simple_serializer.rb +5 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af1cf7cdbe385436458da4107ae3989ba4ab22d1019cedce0581bf52efffd8f2
4
- data.tar.gz: da81b736cf7330063be2039b58aebc6bcb5574cf2cf6220fb8a126a4d46dbe9a
3
+ metadata.gz: '0529a9f40cbaf4119586e1a99bf2f2286d619b636293a6648e3cdf07f80dc2a7'
4
+ data.tar.gz: 5ae69830b9b2ae5619e23790cee691d7d37bdaa8e6c6e525b5620d28484298c3
5
5
  SHA512:
6
- metadata.gz: 6ef2496dde184050de2ecb11f2231b3cd735389f6fb6212cf6260cc35ce5407e7450a8b434ef6efa0ec2cf6790b91f374158132e2bffd0234dc300df87441711
7
- data.tar.gz: 4d28f19efd27d8d689eaffe8f22e0dc52d1e5d4ec87248fe74d9d19098d5fec52ee65e2febc62db9aafcb5b2921b61d57cf8ffa3a99bed29c9c817020bc89d61
6
+ metadata.gz: a76c5f61ab628d1fe0a93ffdb9266e33feedae0ba7b8790a29616302cb1e7b3696852698284892ec384eee79a63b2048409713591fe362bdec3f016b6475702a
7
+ data.tar.gz: 485182001fcf8843d2f18287a362735b4b79900a82cdda10ebdd1cffc87022284d78c53a30a88ecd1de6424ae096f92270a28bc1bb426377669b11bd6f1254ce
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SimpleSerializer
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
5
5
 
6
6
  def initialize(object, opts = {})
7
7
  @include = opts[:include] || []
@@ -27,9 +27,9 @@ class SimpleSerializer
27
27
 
28
28
  Module.new.tap do |m|
29
29
  m.define_singleton_method(:included) do |base|
30
- base.define_method(:to_h) { serializer.to_h(self) }
30
+ base.define_method(:to_h) { |o = {}| serializer.to_h(self, o) }
31
31
 
32
- base.define_method(:to_json) { serializer.to_json(self) }
32
+ base.define_method(:to_json) { |o = {}| serializer.to_json(self, o) }
33
33
 
34
34
  base.define_method(:serializer_class) { serializer }
35
35
  end
@@ -44,8 +44,8 @@ class SimpleSerializer
44
44
  new(object, opts).to_h
45
45
  end
46
46
 
47
- def to_json(object)
48
- to_h(object).to_json
47
+ def to_json(object, opts = {})
48
+ to_h(object, opts).to_json
49
49
  end
50
50
 
51
51
  def attributes(*fields, **named, &block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Slyusarev