extjsizable 1.0.4 → 2.0.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cb2e80339d73a927753e3dc3691539f5f9ca1ff3dda6abdbe4d5bfa9a8f7a7c8
4
+ data.tar.gz: ca0d741559ce744977f20b62420de4cec5ab3fbba9b68a425c3a507d4a8eec94
5
+ SHA512:
6
+ metadata.gz: 72498413e2a372b916423228586a9ef8b483eae545f3eae1e102d105d134a171bc4430fa8bc0f5c445fa1976e39c1e3fb54df7242627725c1f19bdaef05069eb
7
+ data.tar.gz: 376316f0b369ef94e2b39691bd340c3b4b9ce56bccbfe430110d3e6f2b90d56230b156ad4b0ea1bec2122fa8ee0301e4ed654756ab3cae2f215b2a924e66ad13
@@ -9,67 +9,62 @@ module Extjsizable
9
9
  self.wrap_with_brackets = false
10
10
  end
11
11
 
12
- module InstanceMethods
12
+ def to_extjs(options = {})
13
+ success = options.delete(:success)
14
+ underscored_class_name = self.class.to_s.demodulize.underscore
13
15
 
14
- def to_extjs(options = {})
15
- success = options.delete(:success)
16
- underscored_class_name = self.class.to_s.demodulize.underscore
16
+ if success || (success.nil? && errors.empty?)
17
+ # returns success/data to load a form:
18
+ # {
19
+ # "data": {
20
+ # "id": 1,
21
+ # "title": "First Post",
22
+ # "body": "This is my first post.",
23
+ # "published": true, ...
24
+ # },
25
+ # "success": true
26
+ # }
27
+ #
28
+ # If ActiveRecord::Base.include_root_in_json is true then, the model name is used instead of data key:
29
+ # {
30
+ # "post": {
31
+ # "id": 1,
32
+ # "title": "First Post",
33
+ # "body": "This is my first post.",
34
+ # "published": true, ...
35
+ # },
36
+ # "success": true
37
+ # }
38
+ # If ActiveRecord::Base.wrap_with_brackets is true then, the model name is prefixed into data key and all keys are surrounded with brackets:
39
+ # {
40
+ # "data": {
41
+ # "post[id]": 1,
42
+ # "post[title]": "First Post",
43
+ # "post[body]": "This is my first post.",
44
+ # "post[published]": true, ...
45
+ # },
46
+ # "success": true
47
+ # }
17
48
 
18
- if success || (success.nil? && errors.empty?)
19
- # returns success/data to load a form:
20
- # {
21
- # "data": {
22
- # "id": 1,
23
- # "title": "First Post",
24
- # "body": "This is my first post.",
25
- # "published": true, ...
26
- # },
27
- # "success": true
28
- # }
29
- #
30
- # If ActiveRecord::Base.include_root_in_json is true then, the model name is used instead of data key:
31
- # {
32
- # "post": {
33
- # "id": 1,
34
- # "title": "First Post",
35
- # "body": "This is my first post.",
36
- # "published": true, ...
37
- # },
38
- # "success": true
39
- # }
40
- # If ActiveRecord::Base.wrap_with_brackets is true then, the model name is prefixed into data key and all keys are surrounded with brackets:
41
- # {
42
- # "data": {
43
- # "post[id]": 1,
44
- # "post[title]": "First Post",
45
- # "post[body]": "This is my first post.",
46
- # "post[published]": true, ...
47
- # },
48
- # "success": true
49
- # }
50
-
51
- h_json_data = as_json(options)
52
- h_json_data = { :data => h_json_data } unless ::ActiveRecord::Base.include_root_in_json?
53
- h_json_data[h_json_data.keys.first] = wrap_hash_with_brackets(h_json_data.values.first, underscored_class_name) if ::ActiveRecord::Base.wrap_with_brackets?
49
+ h_json_data = as_json(options)
50
+ h_json_data = { :data => h_json_data } unless ::ActiveRecord::Base.include_root_in_json?
51
+ h_json_data[h_json_data.keys.first] = wrap_hash_with_brackets(h_json_data.values.first, underscored_class_name) if ::ActiveRecord::Base.wrap_with_brackets?
54
52
 
55
- { :success => true }.merge(h_json_data)
56
- else
57
- # retrieves no-success/errors to the form:
58
- # {
59
- # "errors": { "title": "Title can't be blank", ... },
60
- # "success": false
61
- # }
53
+ { :success => true }.merge(h_json_data)
54
+ else
55
+ # retrieves no-success/errors to the form:
56
+ # {
57
+ # "errors": { "title": "Title can't be blank", ... },
58
+ # "success": false
59
+ # }
62
60
 
63
- h_json_data = errors.as_json(options)
64
- h_json_data = wrap_hash_with_brackets(h_json_data, underscored_class_name) if ::ActiveRecord::Base.wrap_with_brackets?
65
- { :success => false, :errors => h_json_data.with_indifferent_access }
66
- end.with_indifferent_access
61
+ h_json_data = errors.as_json(options)
62
+ h_json_data = wrap_hash_with_brackets(h_json_data, underscored_class_name) if ::ActiveRecord::Base.wrap_with_brackets?
63
+ { :success => false, :errors => h_json_data.with_indifferent_access }
64
+ end.with_indifferent_access
67
65
 
68
- end
69
66
  end
70
67
 
71
- private
72
-
73
68
  # Wrap with brackets so that {:a => {:b => :c} } becomes to { 'model[a]' : {'b' : 'c'} }
74
69
  def wrap_hash_with_brackets(h, model_name)
75
70
  h.reduce({}) do |nh, (k, v)|
@@ -80,4 +75,3 @@ module Extjsizable
80
75
  end
81
76
  end
82
77
  end
83
-
@@ -0,0 +1,11 @@
1
+ module Extjsizable
2
+ module CoreExt
3
+ module ActiveRecordRelation
4
+ module ExtJs
5
+ def to_extjs(options = {})
6
+ to_a.to_extjs(options) # convert to array and delegate
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -10,39 +10,34 @@ module Extjsizable
10
10
  self.dasherize_keys = false
11
11
  end
12
12
 
13
- module InstanceMethods
14
-
15
- # Creates a JSON object by specifying which attributes we want to be shown.
16
- # Ej:
17
- # { 'total' : 2,
18
- # 'data' : [
19
- # { 'id' : 1, :nombre : 'Juan' },
20
- # { 'id' : 2, :nombre : 'Pedro' }
21
- # ]
22
- # }
23
-
24
- def to_extjs(options = {})
25
- array_json_data = as_json(options)
26
-
27
- if ::Array.dasherize_keys?
28
- array_json_data.map! { |h| dasherize_hash_keys(h) }
29
- end
30
-
31
- { :total => (options.delete(:total) || self.length), :data => array_json_data }.with_indifferent_access
13
+ # Creates a JSON object by specifying which attributes we want to be shown.
14
+ # Ej:
15
+ # { 'total' : 2,
16
+ # 'data' : [
17
+ # { 'id' : 1, :nombre : 'Juan' },
18
+ # { 'id' : 2, :nombre : 'Pedro' }
19
+ # ]
20
+ # }
21
+
22
+ def to_extjs(options = {})
23
+ array_json_data = as_json(options)
24
+
25
+ if ::Array.dasherize_keys?
26
+ array_json_data.map! { |h| dasherize_hash_keys(h) }
32
27
  end
33
28
 
34
- private
35
-
36
- # Dasherize keys that {:a => {:b => :c} } becomes to { 'a_b' => :c }
37
- def dasherize_hash_keys(h, dash_key = '')
38
- return { dash_key => h } unless h.is_a?(Hash)
29
+ { :total => (options.delete(:total) || self.length), :data => array_json_data }.with_indifferent_access
30
+ end
39
31
 
40
- h.reduce({}) do |nh, (k, v)|
41
- nh.merge(dasherize_hash_keys(v, dash_key.blank? ? k.to_s : "#{dash_key}_#{k.to_s}"))
42
- end
43
- end
32
+ # Dasherize keys that {:a => {:b => :c} } becomes to { 'a_b' => :c }
33
+ def dasherize_hash_keys(h, dash_key = '')
34
+ return { dash_key => h } unless h.is_a?(Hash)
44
35
 
36
+ h.reduce({}) do |nh, (k, v)|
37
+ nh.merge(dasherize_hash_keys(v, dash_key.blank? ? k.to_s : "#{dash_key}_#{k.to_s}"))
38
+ end
45
39
  end
40
+
46
41
  end
47
42
  end
48
43
  end
data/lib/extjsizable.rb CHANGED
@@ -3,6 +3,8 @@ require 'active_support/core_ext'
3
3
  require 'active_support/concern'
4
4
  require 'extjsizable/active_record/extjs'
5
5
  require 'extjsizable/core_ext/array/extjs'
6
+ require 'extjsizable/core_ext/active_record_relation/extjs'
6
7
 
7
8
  ActiveRecord::Base.send :include, Extjsizable::ActiveRecord::ExtJs
8
9
  Array.send :include, Extjsizable::CoreExt::Array::ExtJs
10
+ ActiveRecord::Relation.send :include, Extjsizable::CoreExt::ActiveRecordRelation::ExtJs
@@ -9,62 +9,63 @@ describe "Extjsizable" do
9
9
  @category = Category.new :name => 'The category'
10
10
  end
11
11
 
12
- it "should return success : true and a data section when not ActiveRecord::Base.include_root_in_json" do
12
+ it "should return success : true and a data section when not ActiveRecord::Base.include_root_in_json" do
13
13
  ActiveRecord::Base.include_root_in_json = false
14
- @category.should be_valid
15
14
 
16
- json_hash = @category.to_extjs
15
+ expect(@category).to be_valid
17
16
 
18
- json_hash.should_not be_empty
19
- json_hash.should have_key(:success)
20
- json_hash[:success].should be_true
17
+ json_hash = @category.to_extjs
21
18
 
22
- json_hash.should have_key(:data)
19
+ expect(json_hash).not_to be_empty
20
+ expect(json_hash).to have_key(:success)
21
+ expect(json_hash[:success]).to be true
22
+ expect(json_hash).to have_key(:data)
23
23
  end
24
-
25
- it "should return success : true and a category section when ActiveRecord::Base.include_root_in_json" do
24
+
25
+ it "should return success : true and a category section when ActiveRecord::Base.include_root_in_json" do
26
26
  ActiveRecord::Base.include_root_in_json = true
27
- @category.should be_valid
27
+ expect(@category).to be_valid
28
28
 
29
29
  json_hash = @category.to_extjs
30
30
 
31
- json_hash.should_not be_empty
32
- json_hash.should have_key(:success)
33
- json_hash[:success].should be_true
34
- json_hash.should have_key(:category)
31
+ expect(json_hash).not_to be_empty
32
+ expect(json_hash).to have_key(:success)
33
+ expect(json_hash[:success]).to be true
34
+ expect(json_hash).to have_key(:category)
35
35
  end
36
-
37
- it "should return a category section with category[name] key when ActiveRecord::Base.wrap_with_brackets?" do
36
+
37
+ it "should return a category section with category[name] key when ActiveRecord::Base.wrap_with_brackets?" do
38
38
  ActiveRecord::Base.wrap_with_brackets = true
39
39
 
40
40
  json_hash = @category.to_extjs
41
- json_hash[:category].should have_key('category[name]')
41
+ expect(json_hash[:category]).to have_key('category[name]')
42
42
  end
43
43
 
44
44
  it "should return the attribute name of category when not ActiveRecord::Base.wrap_with_brackets?" do
45
45
  ActiveRecord::Base.wrap_with_brackets = false
46
46
 
47
47
  json_hash = @category.to_extjs
48
- json_hash[:category].should have_key(:name)
49
- end
50
-
48
+ expect(json_hash[:category]).to have_key(:name)
49
+ end
50
+
51
51
  it "should return all atributes and the result of the methods specified when called with :methods => [...]" do
52
52
  json_hash = @category.to_extjs(:methods => :my_method)
53
- json_hash[:category].should have_key(:name)
54
- json_hash[:category].should have_key(:my_method)
53
+
54
+ expect(json_hash[:category]).to have_key(:name)
55
+ expect(json_hash[:category]).to have_key(:my_method)
55
56
  end
56
57
 
57
58
  it "should return success : false and an empty errors section when called with :success => false" do
58
59
  json_hash = @category.to_extjs(:success => false)
59
-
60
- json_hash.should have_key(:success)
61
- json_hash[:success].should be_false
62
60
 
63
- json_hash.should_not have_key(:data)
64
- json_hash.should_not have_key(:category)
61
+ expect(json_hash).to have_key(:success)
62
+ expect(json_hash[:success]).to be false
65
63
 
66
- json_hash.should have_key(:errors)
67
- json_hash[:errors].should be_empty
64
+ expect(json_hash).to_not have_key(:data)
65
+ expect(json_hash).to_not have_key(:category)
66
+
67
+ expect(json_hash).to have_key(:errors)
68
+ expect(json_hash[:errors]).to be_empty
68
69
  end
69
70
  end
70
71
 
@@ -75,22 +76,22 @@ describe "Extjsizable" do
75
76
  @category.save
76
77
  end
77
78
 
78
- it "should return success : false and an errors section" do
79
- @category.should_not be_valid
79
+ it "should return success : false and an errors section" do
80
+ expect(@category).to_not be_valid
80
81
 
81
82
  json_hash = @category.to_extjs
82
83
 
83
- json_hash.should_not be_empty
84
- json_hash.should have_key(:success)
85
- json_hash[:success].should be_false
84
+ expect(json_hash).to_not be_empty
85
+ expect(json_hash).to have_key(:success)
86
+ expect(json_hash[:success]).to be false
86
87
 
87
- json_hash.should have_key(:errors)
88
+ expect(json_hash).to have_key(:errors)
88
89
  end
89
-
90
+
90
91
  it "should return the failed attribute name" do
91
92
  json_hash = @category.to_extjs
92
- json_hash[:errors].should have_key(:name)
93
- end
93
+ expect(json_hash[:errors]).to have_key(:name)
94
+ end
94
95
  end
95
96
  end
96
97
 
@@ -104,13 +105,13 @@ describe "Extjsizable" do
104
105
 
105
106
  it 'should return { total => 0, data => [] }' do
106
107
  json_hash = @array.to_extjs
107
- json_hash.should have_key(:total)
108
- json_hash[:total].should == 0
109
- json_hash.should have_key(:data)
110
- json_hash[:data].should be_empty
108
+ expect(json_hash).to have_key(:total)
109
+ expect(json_hash[:total]).to eq(0)
110
+ expect(json_hash).to have_key(:data)
111
+ expect(json_hash[:data]).to be_empty
111
112
  end
112
113
  end
113
-
114
+
114
115
  describe 'with 4 categories with some products each' do
115
116
  before do
116
117
  Product.delete_all
@@ -127,70 +128,70 @@ describe "Extjsizable" do
127
128
 
128
129
  it 'should return { :total => 4, :data => [{ "id" => ..., "name" => "Category ..."}, ...] }' do
129
130
  json_hash = @array.to_extjs
130
- json_hash.should have_key(:total)
131
- json_hash[:total].should == 4
132
-
133
- json_hash.should have_key(:data)
134
- json_hash[:data].should have(4).categories
135
- json_hash[:data].each do |h|
136
- h.should have_key('id')
137
- h.should have_key('name')
131
+ expect(json_hash).to have_key(:total)
132
+ expect(json_hash[:total]).to eq(4)
133
+
134
+ expect(json_hash).to have_key(:data)
135
+ expect(json_hash[:data].size).to eq(4)
136
+ json_hash[:data].each do |h|
137
+ expect(h).to have_key('id')
138
+ expect(h).to have_key('name')
138
139
  end
139
140
  end
140
141
 
141
142
  it 'should return only id attributes when called with :only => :id ' do
142
143
  json_hash = @array.to_extjs :only => :id
143
- json_hash.should have_key(:total)
144
- json_hash[:total].should == 4
145
-
146
- json_hash.should have_key(:data)
147
- json_hash[:data].should have(4).categories
148
- json_hash[:data].each do |h|
149
- h.should have_key('id')
150
- h.should_not have_key('name')
144
+ expect(json_hash).to have_key(:total)
145
+ expect(json_hash[:total]).to eq(4)
146
+
147
+ expect(json_hash).to have_key(:data)
148
+ expect(json_hash[:data].size).to eq(4)
149
+ json_hash[:data].each do |h|
150
+ expect(h).to have_key('id')
151
+ expect(h).to_not have_key('name')
151
152
  end
152
153
  end
153
-
154
+
154
155
  it 'should return only name attributes when called with :except => :id ' do
155
156
  json_hash = @array.to_extjs :except => :id
156
- json_hash.should have_key(:total)
157
- json_hash[:total].should == 4
158
-
159
- json_hash.should have_key(:data)
160
- json_hash[:data].should have(4).categories
161
- json_hash[:data].each do |h|
162
- h.should have_key('name')
163
- h.should_not have_key('id')
157
+ expect(json_hash).to have_key(:total)
158
+ expect(json_hash[:total]).to eq(4)
159
+
160
+ expect(json_hash).to have_key(:data)
161
+ expect(json_hash[:data].size).to eq(4)
162
+ json_hash[:data].each do |h|
163
+ expect(h).to have_key('name')
164
+ expect(h).to_not have_key('id')
164
165
  end
165
166
  end
166
-
167
+
167
168
  it 'should return only related data attributes with :include => :products ' do
168
169
  json_hash = @array.to_extjs :include => :products
169
- json_hash.should have_key(:total)
170
- json_hash[:total].should == 4
171
-
172
- json_hash.should have_key(:data)
173
- json_hash[:data].should have(4).categories
174
- json_hash[:data].each do |h|
175
- h.should have_key('name')
176
- h.should have_key('id')
177
- h.should have_key('products')
178
- h[:products].should have(2).items
170
+ expect(json_hash).to have_key(:total)
171
+ expect(json_hash[:total]).to eq(4)
172
+
173
+ expect(json_hash).to have_key(:data)
174
+ expect(json_hash[:data].size).to eq(4)
175
+ json_hash[:data].each do |h|
176
+ expect(h).to have_key('name')
177
+ expect(h).to have_key('id')
178
+ expect(h).to have_key('products')
179
+ expect(h['products'].size).to eq(2)
179
180
  end
180
181
  end
181
-
182
+
182
183
  it 'should return only related data attributes with :include => :category and dasherize all keys' do
183
184
  Array.dasherize_keys = true
184
185
  json_hash = Product.all.to_extjs :include => :category
185
- json_hash.should have_key(:total)
186
- json_hash[:total].should == 8
187
-
188
- json_hash.should have_key(:data)
189
- json_hash[:data].should have(8).items
190
- json_hash[:data].each do |h|
191
- h.should have_key('name')
192
- h.should have_key('id')
193
- h.should have_key('category_name')
186
+ expect(json_hash).to have_key(:total)
187
+ expect(json_hash[:total]).to eq(8)
188
+
189
+ expect(json_hash).to have_key(:data)
190
+ expect(json_hash[:data].size).to eq(8)
191
+ json_hash[:data].each do |h|
192
+ expect(h).to have_key('name')
193
+ expect(h).to have_key('id')
194
+ expect(h).to have_key('category_name')
194
195
  end
195
196
  end
196
197
 
metadata CHANGED
@@ -1,142 +1,124 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extjsizable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
5
- prerelease:
4
+ version: 2.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ungue
8
+ - dotpao
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-28 00:00:00.000000000Z
12
+ date: 2025-05-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rake
16
- requirement: &23070120 !ruby/object:Gem::Requirement
17
- none: false
15
+ name: activerecord
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  requirements:
19
- - - ~>
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
- version: 0.9.2
20
+ version: '5.2'
22
21
  type: :runtime
23
22
  prerelease: false
24
- version_requirements: *23070120
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '5.2'
25
28
  - !ruby/object:Gem::Dependency
26
29
  name: activesupport
27
- requirement: &23069560 !ruby/object:Gem::Requirement
28
- none: false
30
+ requirement: !ruby/object:Gem::Requirement
29
31
  requirements:
30
- - - ! '>='
32
+ - - ">="
31
33
  - !ruby/object:Gem::Version
32
- version: '3.0'
34
+ version: '5.2'
33
35
  type: :runtime
34
36
  prerelease: false
35
- version_requirements: *23069560
36
- - !ruby/object:Gem::Dependency
37
- name: activerecord
38
- requirement: &23069040 !ruby/object:Gem::Requirement
39
- none: false
37
+ version_requirements: !ruby/object:Gem::Requirement
40
38
  requirements:
41
- - - ! '>='
39
+ - - ">="
42
40
  - !ruby/object:Gem::Version
43
- version: '3.0'
44
- type: :runtime
45
- prerelease: false
46
- version_requirements: *23069040
41
+ version: '5.2'
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: rspec
49
- requirement: &23068460 !ruby/object:Gem::Requirement
50
- none: false
44
+ requirement: !ruby/object:Gem::Requirement
51
45
  requirements:
52
- - - ~>
46
+ - - "~>"
53
47
  - !ruby/object:Gem::Version
54
- version: 2.3.0
48
+ version: '3.12'
55
49
  type: :development
56
50
  prerelease: false
57
- version_requirements: *23068460
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '3.12'
58
56
  - !ruby/object:Gem::Dependency
59
57
  name: bundler
60
- requirement: &23067940 !ruby/object:Gem::Requirement
61
- none: false
58
+ requirement: !ruby/object:Gem::Requirement
62
59
  requirements:
63
- - - ~>
60
+ - - "~>"
64
61
  - !ruby/object:Gem::Version
65
- version: 1.0.0
62
+ version: '2.0'
66
63
  type: :development
67
64
  prerelease: false
68
- version_requirements: *23067940
69
- - !ruby/object:Gem::Dependency
70
- name: jeweler
71
- requirement: &23067420 !ruby/object:Gem::Requirement
72
- none: false
65
+ version_requirements: !ruby/object:Gem::Requirement
73
66
  requirements:
74
- - - ~>
67
+ - - "~>"
75
68
  - !ruby/object:Gem::Version
76
- version: 1.6.3
77
- type: :development
78
- prerelease: false
79
- version_requirements: *23067420
69
+ version: '2.0'
80
70
  - !ruby/object:Gem::Dependency
81
- name: rcov
82
- requirement: &23066900 !ruby/object:Gem::Requirement
83
- none: false
71
+ name: rake
72
+ requirement: !ruby/object:Gem::Requirement
84
73
  requirements:
85
- - - ! '>='
74
+ - - "~>"
86
75
  - !ruby/object:Gem::Version
87
- version: '0'
76
+ version: '13.0'
88
77
  type: :development
89
78
  prerelease: false
90
- version_requirements: *23066900
91
- description: You can create REST services to be used for Ext JS 4 in an easy manner
92
- by calling to_extjs in your models or arrays.
93
- email: ungue79@yahoo.es
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '13.0'
84
+ description: Allows your models and collections to generate the JSON structure expected
85
+ by Ext JS 4-compatible frontends.
86
+ email:
87
+ - carlos@rodriguez-ruiz.com
94
88
  executables: []
95
89
  extensions: []
96
- extra_rdoc_files:
97
- - LICENSE.txt
98
- - README.rdoc
90
+ extra_rdoc_files: []
99
91
  files:
100
- - .document
101
- - Gemfile
102
- - Gemfile.lock
103
92
  - LICENSE.txt
104
93
  - README.rdoc
105
- - Rakefile
106
- - VERSION
107
- - extjsizable.gemspec
108
94
  - lib/extjsizable.rb
109
95
  - lib/extjsizable/active_record/extjs.rb
96
+ - lib/extjsizable/core_ext/active_record_relation/extjs.rb
110
97
  - lib/extjsizable/core_ext/array/extjs.rb
111
98
  - spec/extjsizable_spec.rb
112
99
  - spec/spec_helper.rb
113
- homepage: http://github.com/ungue/extjsizable
100
+ homepage: https://github.com/dotpao/extjsizable
114
101
  licenses:
115
102
  - MIT
103
+ metadata: {}
116
104
  post_install_message:
117
105
  rdoc_options: []
118
106
  require_paths:
119
107
  - lib
120
108
  required_ruby_version: !ruby/object:Gem::Requirement
121
- none: false
122
109
  requirements:
123
- - - ! '>='
110
+ - - ">="
124
111
  - !ruby/object:Gem::Version
125
- version: '0'
126
- segments:
127
- - 0
128
- hash: 632321153601536538
112
+ version: '2.6'
129
113
  required_rubygems_version: !ruby/object:Gem::Requirement
130
- none: false
131
114
  requirements:
132
- - - ! '>='
115
+ - - ">="
133
116
  - !ruby/object:Gem::Version
134
117
  version: '0'
135
118
  requirements: []
136
- rubyforge_project:
137
- rubygems_version: 1.8.10
119
+ rubygems_version: 3.5.22
138
120
  signing_key:
139
- specification_version: 3
140
- summary: Allow your models and collections to generate the JSON structure accepted
141
- by Ext JS 4
121
+ specification_version: 4
122
+ summary: Adds `to_extjs` to ActiveRecord models and arrays to serialize JSON for Ext
123
+ JS.
142
124
  test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/Gemfile DELETED
@@ -1,19 +0,0 @@
1
- source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- gem "rake", "~> 0.9.2"
5
- gem "activesupport", ">= 3.0"
6
- gem "activerecord", ">= 3.0"
7
-
8
- # Add dependencies to develop your gem here.
9
- # Include everything needed to run rake, tests, features, etc.
10
- group :development do
11
- gem "rspec", "~> 2.3.0"
12
- gem "bundler", "~> 1.0.0"
13
- gem "jeweler", "~> 1.6.3"
14
- gem "rcov", ">= 0"
15
- end
16
-
17
- group :test do
18
- gem "sqlite3"
19
- end
data/Gemfile.lock DELETED
@@ -1,47 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- activemodel (3.0.5)
5
- activesupport (= 3.0.5)
6
- builder (~> 2.1.2)
7
- i18n (~> 0.4)
8
- activerecord (3.0.5)
9
- activemodel (= 3.0.5)
10
- activesupport (= 3.0.5)
11
- arel (~> 2.0.2)
12
- tzinfo (~> 0.3.23)
13
- activesupport (3.0.5)
14
- arel (2.0.9)
15
- builder (2.1.2)
16
- diff-lcs (1.1.2)
17
- git (1.2.5)
18
- i18n (0.5.0)
19
- jeweler (1.6.3)
20
- bundler (~> 1.0)
21
- git (>= 1.2.5)
22
- rake
23
- rake (0.9.2)
24
- rcov (0.9.9)
25
- rspec (2.3.0)
26
- rspec-core (~> 2.3.0)
27
- rspec-expectations (~> 2.3.0)
28
- rspec-mocks (~> 2.3.0)
29
- rspec-core (2.3.1)
30
- rspec-expectations (2.3.0)
31
- diff-lcs (~> 1.1.2)
32
- rspec-mocks (2.3.0)
33
- sqlite3 (1.3.3)
34
- tzinfo (0.3.25)
35
-
36
- PLATFORMS
37
- ruby
38
-
39
- DEPENDENCIES
40
- activerecord (>= 3.0)
41
- activesupport (>= 3.0)
42
- bundler (~> 1.0.0)
43
- jeweler (~> 1.6.3)
44
- rake (~> 0.9.2)
45
- rcov
46
- rspec (~> 2.3.0)
47
- sqlite3
data/Rakefile DELETED
@@ -1,49 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "extjsizable"
18
- gem.homepage = "http://github.com/ungue/extjsizable"
19
- gem.license = "MIT"
20
- gem.summary = %Q{Allow your models and collections to generate the JSON structure accepted by Ext JS 4}
21
- gem.description = %Q{You can create REST services to be used for Ext JS 4 in an easy manner by calling to_extjs in your models or arrays.}
22
- gem.email = "ungue79@yahoo.es"
23
- gem.authors = ["Ungue"]
24
- # dependencies defined in Gemfile
25
- end
26
- Jeweler::RubygemsDotOrgTasks.new
27
-
28
- require 'rspec/core'
29
- require 'rspec/core/rake_task'
30
- RSpec::Core::RakeTask.new(:spec) do |spec|
31
- spec.pattern = FileList['spec/**/*_spec.rb']
32
- end
33
-
34
- RSpec::Core::RakeTask.new(:rcov) do |spec|
35
- spec.pattern = 'spec/**/*_spec.rb'
36
- spec.rcov = true
37
- end
38
-
39
- task :default => :spec
40
-
41
- require 'rake/rdoctask'
42
- Rake::RDocTask.new do |rdoc|
43
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
-
45
- rdoc.rdoc_dir = 'rdoc'
46
- rdoc.title = "extjsizable #{version}"
47
- rdoc.rdoc_files.include('README*')
48
- rdoc.rdoc_files.include('lib/**/*.rb')
49
- end
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.0.4
data/extjsizable.gemspec DELETED
@@ -1,70 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "extjsizable"
8
- s.version = "1.0.4"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Ungue"]
12
- s.date = "2012-04-28"
13
- s.description = "You can create REST services to be used for Ext JS 4 in an easy manner by calling to_extjs in your models or arrays."
14
- s.email = "ungue79@yahoo.es"
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "LICENSE.txt",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "extjsizable.gemspec",
28
- "lib/extjsizable.rb",
29
- "lib/extjsizable/active_record/extjs.rb",
30
- "lib/extjsizable/core_ext/array/extjs.rb",
31
- "spec/extjsizable_spec.rb",
32
- "spec/spec_helper.rb"
33
- ]
34
- s.homepage = "http://github.com/ungue/extjsizable"
35
- s.licenses = ["MIT"]
36
- s.require_paths = ["lib"]
37
- s.rubygems_version = "1.8.10"
38
- s.summary = "Allow your models and collections to generate the JSON structure accepted by Ext JS 4"
39
-
40
- if s.respond_to? :specification_version then
41
- s.specification_version = 3
42
-
43
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
- s.add_runtime_dependency(%q<rake>, ["~> 0.9.2"])
45
- s.add_runtime_dependency(%q<activesupport>, [">= 3.0"])
46
- s.add_runtime_dependency(%q<activerecord>, [">= 3.0"])
47
- s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
48
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
49
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.3"])
50
- s.add_development_dependency(%q<rcov>, [">= 0"])
51
- else
52
- s.add_dependency(%q<rake>, ["~> 0.9.2"])
53
- s.add_dependency(%q<activesupport>, [">= 3.0"])
54
- s.add_dependency(%q<activerecord>, [">= 3.0"])
55
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
56
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
57
- s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
58
- s.add_dependency(%q<rcov>, [">= 0"])
59
- end
60
- else
61
- s.add_dependency(%q<rake>, ["~> 0.9.2"])
62
- s.add_dependency(%q<activesupport>, [">= 3.0"])
63
- s.add_dependency(%q<activerecord>, [">= 3.0"])
64
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
65
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
66
- s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
67
- s.add_dependency(%q<rcov>, [">= 0"])
68
- end
69
- end
70
-