mongoid-nested-serialization 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ module Mongoid
11
11
 
12
12
  module ClassMethods
13
13
  def find_by_json(json)
14
- Mongoid::NestedSerialization::Finder.new(self).find(json)
14
+ Mongoid::NestedSerialization::Finder.find(json)
15
15
  end
16
16
  end
17
17
 
@@ -3,26 +3,22 @@ require "multi_json"
3
3
  module Mongoid
4
4
  module NestedSerialization
5
5
  class Finder
6
- def initialize(klass)
7
- @klass = klass
8
- end
9
-
10
6
  # parse the raw JSON data into a hash
11
- def parse_input(json)
7
+ def self.parse_input(json)
12
8
  MultiJson.load(json)
13
9
  end
14
10
 
15
11
  # load the top level object directly with the collection
16
- def top_level_object(data)
12
+ def self.top_level_object(data)
17
13
  data["class_name"].constantize.find(data["id"])
18
14
  end
19
15
 
20
16
  # load an object nested within another, using the data
21
- def nested_object(object, data)
17
+ def self.nested_object(object, data)
22
18
  object.send(data["association"]).find(data["id"])
23
19
  end
24
20
 
25
- def find(json)
21
+ def self.find(json)
26
22
  data = parse_input(json)
27
23
  # load the top level object
28
24
  object = top_level_object(data)
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module NestedSerialization
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-nested-serialization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -152,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  segments:
154
154
  - 0
155
- hash: 1142570094106982720
155
+ hash: 2507334667265849704
156
156
  required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  none: false
158
158
  requirements:
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  version: '0'
162
162
  segments:
163
163
  - 0
164
- hash: 1142570094106982720
164
+ hash: 2507334667265849704
165
165
  requirements: []
166
166
  rubyforge_project:
167
167
  rubygems_version: 1.8.24