dao 5.5.0 → 5.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -32,7 +32,7 @@ def run_tests!(which = nil)
32
32
 
33
33
  test_rbs.each_with_index do |test_rb, index|
34
34
  testno = index + 1
35
- command = "#{ This.ruby } -w -I ./lib -I ./test/lib #{ test_rb }"
35
+ command = "#{ This.ruby } -I ./lib -I ./test/lib #{ test_rb }"
36
36
 
37
37
  puts
38
38
  say(div, :color => :cyan, :bold => true)
data/a.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'dao'
2
+
3
+ form = Dao::Form.new(Map.for(:name => 'key'))
4
+
5
+ key = form.key_for(:a, '{{ i }}', :b, '{{ j }}')
6
+
7
+ p key
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "dao"
6
- spec.version = "5.5.0"
6
+ spec.version = "5.5.1"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "dao"
9
9
  spec.description = "presenter, conducer, api, and better form objects for you rails' pleasure"
@@ -14,6 +14,7 @@ Gem::Specification::new do |spec|
14
14
  "Gemfile.lock",
15
15
  "README",
16
16
  "Rakefile",
17
+ "a.rb",
17
18
  "dao.gemspec",
18
19
  "lib",
19
20
  "lib/dao",
@@ -85,6 +86,8 @@ Gem::Specification::new do |spec|
85
86
  "lib/dao/validations/common.rb",
86
87
  "lib/dao/validations/instance.rb",
87
88
  "lib/dao/validations/validator.rb",
89
+ "notes",
90
+ "notes/ara.txt",
88
91
  "test",
89
92
  "test/active_model_conducer_lint_test.rb",
90
93
  "test/api_test.rb",
data/lib/dao.rb CHANGED
@@ -11,7 +11,7 @@
11
11
  # dao libs
12
12
  #
13
13
  module Dao
14
- Version = '5.5.0' unless defined?(Version)
14
+ Version = '5.5.1' unless defined?(Version)
15
15
 
16
16
  def version
17
17
  Dao::Version
@@ -28,6 +28,11 @@ module Dao
28
28
  @controller.send(:request) if @controller
29
29
  end
30
30
 
31
+ def request_method
32
+ method = request.try(:method)
33
+ method ? method.to_s.to_sym.upcase : nil
34
+ end
35
+
31
36
  ##
32
37
  #
33
38
  class Action < ::String
@@ -120,6 +120,9 @@ module Dao
120
120
 
121
121
  paths_and_values.each do |path, value|
122
122
  keys = keys_for(path)
123
+ if map.has?(keys)
124
+ inc_keys!(keys)
125
+ end
123
126
  map.set(keys => value)
124
127
  end
125
128
 
@@ -141,9 +144,24 @@ module Dao
141
144
  digity ? stringy ? String(digits) : Integer(digits) : key
142
145
  end
143
146
  end
144
-
145
147
  alias_method(:key_for, :keys_for)
146
148
 
149
+ def inc_keys!(keys)
150
+ last_number_index = nil
151
+
152
+ keys.each_with_index do |k, i|
153
+ if k.is_a?(Number)
154
+ last_number_index = i
155
+ end
156
+ end
157
+
158
+ if last_number_index
159
+ keys[last_number_index] = keys[last_number_index] + 1
160
+ end
161
+
162
+ keys
163
+ end
164
+
147
165
  def render_json(object, options = {})
148
166
  options = options.to_options!
149
167
  controller = options[:controller] || Dao.current_controller
@@ -0,0 +1,11 @@
1
+ todo:
2
+
3
+ - rack parameter encoding or safe array parsing
4
+
5
+ - kill api layer?
6
+
7
+ - conducer document
8
+ - def prepare // lifecycle changes
9
+
10
+
11
+ done:
@@ -52,7 +52,7 @@ Testing Dao::Form do
52
52
  assert do
53
53
  scmp(
54
54
  html,
55
- '<select name="dao[form][key]" class="dao" id="form_key"/>'
55
+ '<select name="dao[form][key]" class="dao" id="form_key"> </select>'
56
56
  )
57
57
  end
58
58
 
@@ -33,6 +33,8 @@ Testing Dao::Conducer do
33
33
 
34
34
  assert{ Dao.normalize_parameters(params) }
35
35
 
36
+ #require 'pry'
37
+ #binding.pry
36
38
  assert{ params[:foos].is_a?(Hash) }
37
39
  assert{ params[:foos][:k] == 'v' }
38
40
  assert{ params[:foos][:array] == %w( 0 1 ) }
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dao
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.0
4
+ version: 5.5.1
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Ara T. Howard
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-04-24 00:00:00.000000000 Z
12
+ date: 2016-09-17 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rails
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: map
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ! '>='
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: fattr
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ! '>='
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ! '>='
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: coerce
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ! '>='
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ! '>='
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: tagz
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ! '>='
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - ! '>='
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: multi_json
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - ! '>='
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - ! '>='
95
108
  - !ruby/object:Gem::Version
@@ -97,6 +110,7 @@ dependencies:
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: uuidtools
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
115
  - - ! '>='
102
116
  - !ruby/object:Gem::Version
@@ -104,6 +118,7 @@ dependencies:
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
123
  - - ! '>='
109
124
  - !ruby/object:Gem::Version
@@ -111,6 +126,7 @@ dependencies:
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: wrap
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
131
  - - ! '>='
116
132
  - !ruby/object:Gem::Version
@@ -118,6 +134,7 @@ dependencies:
118
134
  type: :runtime
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
139
  - - ! '>='
123
140
  - !ruby/object:Gem::Version
@@ -125,6 +142,7 @@ dependencies:
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: rails_current
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
147
  - - ! '>='
130
148
  - !ruby/object:Gem::Version
@@ -132,6 +150,7 @@ dependencies:
132
150
  type: :runtime
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
155
  - - ! '>='
137
156
  - !ruby/object:Gem::Version
@@ -139,6 +158,7 @@ dependencies:
139
158
  - !ruby/object:Gem::Dependency
140
159
  name: rails_errors2html
141
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
142
162
  requirements:
143
163
  - - ! '>='
144
164
  - !ruby/object:Gem::Version
@@ -146,6 +166,7 @@ dependencies:
146
166
  type: :runtime
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
149
170
  requirements:
150
171
  - - ! '>='
151
172
  - !ruby/object:Gem::Version
@@ -160,6 +181,7 @@ files:
160
181
  - Gemfile.lock
161
182
  - README
162
183
  - Rakefile
184
+ - a.rb
163
185
  - dao.gemspec
164
186
  - lib/dao.rb
165
187
  - lib/dao/active_record.rb
@@ -219,6 +241,7 @@ files:
219
241
  - lib/dao/validations/common.rb
220
242
  - lib/dao/validations/instance.rb
221
243
  - lib/dao/validations/validator.rb
244
+ - notes/ara.txt
222
245
  - test/active_model_conducer_lint_test.rb
223
246
  - test/api_test.rb
224
247
  - test/conducer_test.rb
@@ -233,25 +256,27 @@ files:
233
256
  homepage: https://github.com/ahoward/dao
234
257
  licenses:
235
258
  - same as ruby's
236
- metadata: {}
237
259
  post_install_message:
238
260
  rdoc_options: []
239
261
  require_paths:
240
262
  - lib
241
263
  required_ruby_version: !ruby/object:Gem::Requirement
264
+ none: false
242
265
  requirements:
243
266
  - - ! '>='
244
267
  - !ruby/object:Gem::Version
245
268
  version: '0'
246
269
  required_rubygems_version: !ruby/object:Gem::Requirement
270
+ none: false
247
271
  requirements:
248
272
  - - ! '>='
249
273
  - !ruby/object:Gem::Version
250
274
  version: '0'
251
275
  requirements: []
252
276
  rubyforge_project: codeforpeople
253
- rubygems_version: 2.0.3
277
+ rubygems_version: 1.8.23.2
254
278
  signing_key:
255
- specification_version: 4
279
+ specification_version: 3
256
280
  summary: dao
257
281
  test_files: []
282
+ has_rdoc:
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ODJiYmNmMGY2MDdkYjM1MThiOTUyOGFkMzc5ZDkwMTNhYjA1YjNhYw==
5
- data.tar.gz: !binary |-
6
- YzRmOWI5Y2ViYjM0NjM5MWFiMDYzZjFhMjEwYjNkMjJkMTJlNmY1Mw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- YzU1M2Y0NWM5MGU2OWI0NTU5MGFlOGQzZWI0MjRkNzEwZTllZGRmMDJkOGNk
10
- ZjhlNjAzZjc4OWFmM2M5YjhmMTNlNWVhMWMxNWFhOTgwZTQ4MDdlYTg1MGY0
11
- YmY5NWI5N2E0NjYzZmM4NjA5ZDYwNWYyYmI5Zjk4NWJiZTNiOTg=
12
- data.tar.gz: !binary |-
13
- YTc5NDY5OTBlYjA1MWRjZjA3MjI5MzliOTlhNzQ1MTljZjc3NGJiMjFhY2Y0
14
- ZjJjYmQxN2RmZmViMDEzMjlhOWE5ZDEwODVlOTUwMmUwMGE3ZWZiMzEwZDkw
15
- ZjdlNGFkMjJmN2JmZWZhZTg0N2U1ZDUyMWEwMGY4ZDJmMDJlYjg=