activeresource 3.2.22.5 → 4.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activeresource might be problematic. Click here for more details.

@@ -1,20 +0,0 @@
1
- Copyright (c) 2006-2011 David Heinemeier Hansson
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,70 +0,0 @@
1
- require 'rubygems'
2
- require 'active_resource'
3
- require 'benchmark'
4
-
5
- TIMES = (ENV['N'] || 10_000).to_i
6
-
7
- # deep nested resource
8
- attrs = {
9
- :id => 1,
10
- :name => 'Luis',
11
- :age => 21,
12
- :friends => [
13
- {
14
- :name => 'JK',
15
- :age => 24,
16
- :colors => ['red', 'green', 'blue'],
17
- :brothers => [
18
- {
19
- :name => 'Mateo',
20
- :age => 35,
21
- :children => [{ :name => 'Edith', :age => 5 }, { :name => 'Martha', :age => 4 }]
22
- },
23
- {
24
- :name => 'Felipe',
25
- :age => 33,
26
- :children => [{ :name => 'Bryan', :age => 1 }, { :name => 'Luke', :age => 0 }]
27
- }
28
- ]
29
- },
30
- {
31
- :name => 'Eduardo',
32
- :age => 20,
33
- :colors => [],
34
- :brothers => [
35
- {
36
- :name => 'Sebas',
37
- :age => 23,
38
- :children => [{ :name => 'Andres', :age => 0 }, { :name => 'Jorge', :age => 2 }]
39
- },
40
- {
41
- :name => 'Elsa',
42
- :age => 19,
43
- :children => [{ :name => 'Natacha', :age => 1 }]
44
- },
45
- {
46
- :name => 'Milena',
47
- :age => 16,
48
- :children => []
49
- }
50
- ]
51
- }
52
- ]
53
- }
54
-
55
- class Customer < ActiveResource::Base
56
- self.site = "http://37s.sunrise.i:3000"
57
- end
58
-
59
- module Nested
60
- class Customer < ActiveResource::Base
61
- self.site = "http://37s.sunrise.i:3000"
62
- end
63
- end
64
-
65
- Benchmark.bm(40) do |x|
66
- x.report('Model.new (instantiation)') { TIMES.times { Customer.new } }
67
- x.report('Nested::Model.new (instantiation)') { TIMES.times { Nested::Customer.new } }
68
- x.report('Model.new (setting attributes)') { TIMES.times { Customer.new attrs } }
69
- x.report('Nested::Model.new (setting attributes)') { TIMES.times { Nested::Customer.new attrs } }
70
- end