dozer 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 836066ffb0fbb3e71155b9c8c5310429caae2ab5c461a482758dbbe3e0e7d94f
4
- data.tar.gz: 6a513410751eee299ee93c4eef48aabf880dfcf6ddf2c74113925b52295f30be
3
+ metadata.gz: 62030399ff459ea3faa84a94ad61a07fbe6346bc4d44dd624ebbc45e77d6fb94
4
+ data.tar.gz: 01fc7b2747cc0e20d5c120aa54fe440f4bb7f319dcb5ceb443db413644534190
5
5
  SHA512:
6
- metadata.gz: 74be06f97c5baa3fa776e82187ed262b1276f33973a62d2cd1ca0c0a46a0ba77c3bf82ea723df4b4be19b837959b785f632636b1d761097d1b3d1d7d03f9f34e
7
- data.tar.gz: 357302fad4df18f5dcebbc3aa6cd5e4270c4342d6b9192b3a629e986f74705ab1fd34d31f1e97e1f8dfdae6029a911e0148b237212e3c6f9aeb770d3365d0d11
6
+ metadata.gz: 43f96e33fcde5a798e5994f47e8cb3b3f0cb76c47f320d04e8b766d40e1afa552fc72174e94074e6740b8077627386fd000954ed2f14644a404aa37c8314a72d
7
+ data.tar.gz: ab843c5dde18a4b7e02d6983d92fa26b2a664314e011b8c96b280a2e2b0dbfc0c57abc4cab4de0aac547d4d2fed303955cced5aed354fffe7dc54812ef0fbc8d
@@ -3,13 +3,14 @@ module Dozer
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- attr_accessor :input, :output
6
+ attr_accessor :input, :output, :options
7
7
  end
8
8
 
9
- def initialize(input)
9
+ def initialize(input, data = {})
10
10
  @input = input.with_indifferent_access
11
11
  @output = ActiveSupport::HashWithIndifferentAccess.new
12
- end
12
+ @options = data&.with_indifferent_access || {}
13
+ end
13
14
 
14
15
  module ClassMethods
15
16
 
@@ -17,8 +18,8 @@ module Dozer
17
18
  append_rule(Dozer::Rule.new(options))
18
19
  end
19
20
 
20
- def transform(input)
21
- instance = self.new(input)
21
+ def transform(input, data={})
22
+ instance = self.new(input, data)
22
23
  all_rules.each { |rule| rule.apply!(instance) }
23
24
  instance.output
24
25
  end
data/lib/dozer/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dozer
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.3"
3
3
  end
data/lib/dozer.rb CHANGED
@@ -9,6 +9,6 @@ module Dozer
9
9
 
10
10
  # transform the data from one schema to another schema.
11
11
  def self.map(hash, mapper, options={})
12
- mapper.transform(hash)
12
+ mapper.transform(hash, options)
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dozer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Workstream.us
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-17 00:00:00.000000000 Z
11
+ date: 2023-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  requirements: []
126
- rubygems_version: 3.0.6
126
+ rubygems_version: 3.4.19
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: map a hash from one schema to another schema