dao 5.2.1 → 5.3.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 +8 -8
- data/Gemfile.lock +1 -1
- data/dao.gemspec +4 -3
- data/lib/dao.rb +4 -3
- data/lib/dao/conducer.rb +3 -0
- data/lib/dao/conducer/active_model.rb +2 -0
- data/lib/dao/errors.rb +1 -1
- data/lib/dao/form.rb +47 -30
- data/lib/dao/messages.rb +107 -0
- data/lib/dao/rails/lib/generators/dao/templates/dao.js +84 -91
- data/lib/dao/validations/validator.rb +15 -20
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGViMmUzODVjMzE1ZTRhMjM4MjAyZjYxZTZhOGFkY2U1ODdmYjQ3Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmFhNzhhNDJmYjFkNWEzOTNlZmNhNDg5ZTQ1MmE5YTYzMzNlMjcyZg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjQ1NmU2NTYzZTFjMDgzZDFkMjE5NGZjMDZjODBjOGNkNDU4Y2NlZTJmMDY0
|
10
|
+
MWE0MDcxYjE5ZWJhYzE4ZDAxNjY3Nzc0Mjc5OWUzMjgzMWZlNTQzZWJkNTQ4
|
11
|
+
NTJiMWMwMzdiZjNmNjliZjNhMjI1NjdkZjdmMDRiMTFmZDUwYzc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGUyYmFjNTk5ZDU2YTUxMjE0OGI3YWUxNzlkZDJkYzQyODVlMjNiMTU1OWUx
|
14
|
+
MTJhN2ZjNTI5ZTk0MTM1NWUzMzAxM2RhMWQxYzJhYzU2ZTQ3MDY0MDU5MzNm
|
15
|
+
ZWE3ODg2ZWFlMjRjMTA3ZWM0OGVhNDg0MmQ2MTQ4ZTViYjg2MGY=
|
data/Gemfile.lock
CHANGED
data/dao.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "dao"
|
6
|
-
spec.version = "5.
|
6
|
+
spec.version = "5.3.0"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "dao"
|
9
9
|
spec.description = "description: dao kicks the ass"
|
@@ -45,6 +45,7 @@ Gem::Specification::new do |spec|
|
|
45
45
|
"lib/dao/extractor.rb",
|
46
46
|
"lib/dao/form.rb",
|
47
47
|
"lib/dao/instance_exec.rb",
|
48
|
+
"lib/dao/messages.rb",
|
48
49
|
"lib/dao/mode.rb",
|
49
50
|
"lib/dao/mongo_mapper.rb",
|
50
51
|
"lib/dao/name.rb",
|
@@ -112,7 +113,7 @@ Gem::Specification::new do |spec|
|
|
112
113
|
|
113
114
|
spec.add_dependency(*["coerce", " >= 0.0.3"])
|
114
115
|
|
115
|
-
spec.add_dependency(*["tagz", " >= 9.9.
|
116
|
+
spec.add_dependency(*["tagz", " >= 9.9.2"])
|
116
117
|
|
117
118
|
spec.add_dependency(*["multi_json", " >= 1.0.3"])
|
118
119
|
|
@@ -120,7 +121,7 @@ Gem::Specification::new do |spec|
|
|
120
121
|
|
121
122
|
spec.add_dependency(*["wrap", " >= 1.5.0"])
|
122
123
|
|
123
|
-
spec.add_dependency(*["rails_current", " >= 1.
|
124
|
+
spec.add_dependency(*["rails_current", " >= 1.8.0"])
|
124
125
|
|
125
126
|
spec.add_dependency(*["rails_errors2html", " >= 1.3.0"])
|
126
127
|
|
data/lib/dao.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
# dao libs
|
12
12
|
#
|
13
13
|
module Dao
|
14
|
-
Version = '5.
|
14
|
+
Version = '5.3.0' unless defined?(Version)
|
15
15
|
|
16
16
|
def version
|
17
17
|
Dao::Version
|
@@ -23,11 +23,11 @@
|
|
23
23
|
'map' => [ 'map' , ' >= 6.0.0' ] ,
|
24
24
|
'fattr' => [ 'fattr' , ' >= 2.2' ] ,
|
25
25
|
'coerce' => [ 'coerce' , ' >= 0.0.3' ] ,
|
26
|
-
'tagz' => [ 'tagz' , ' >= 9.9.
|
26
|
+
'tagz' => [ 'tagz' , ' >= 9.9.2' ] ,
|
27
27
|
'multi_json' => [ 'multi_json' , ' >= 1.0.3' ] ,
|
28
28
|
'uuidtools' => [ 'uuidtools' , ' >= 2.1.2' ] ,
|
29
29
|
'wrap' => [ 'wrap' , ' >= 1.5.0' ] ,
|
30
|
-
'rails_current' => [ 'rails_current' , ' >= 1.
|
30
|
+
'rails_current' => [ 'rails_current' , ' >= 1.8.0' ] ,
|
31
31
|
'rails_errors2html' => [ 'rails_errors2html' , ' >= 1.3.0' ] ,
|
32
32
|
}
|
33
33
|
end
|
@@ -94,6 +94,7 @@
|
|
94
94
|
status.rb
|
95
95
|
path_map.rb
|
96
96
|
errors.rb
|
97
|
+
messages.rb
|
97
98
|
form.rb
|
98
99
|
validations.rb
|
99
100
|
data.rb
|
data/lib/dao/conducer.rb
CHANGED
@@ -90,6 +90,7 @@ module Dao
|
|
90
90
|
form
|
91
91
|
params
|
92
92
|
errors
|
93
|
+
messages
|
93
94
|
models
|
94
95
|
model
|
95
96
|
conduces
|
@@ -150,6 +151,7 @@ module Dao
|
|
150
151
|
|
151
152
|
@params = Map.new
|
152
153
|
@attributes = Attributes.for(self)
|
154
|
+
@messages = Messages.for(self)
|
153
155
|
|
154
156
|
@form = Form.for(self)
|
155
157
|
@form.name = self.class.model_name.singular.sub(/_+$/, '')
|
@@ -524,4 +526,5 @@ module Dao
|
|
524
526
|
Resource = Conducer
|
525
527
|
Presenter = Conducer
|
526
528
|
Conductor = Conducer
|
529
|
+
Model = Conducer
|
527
530
|
end
|
@@ -24,10 +24,12 @@ module Dao
|
|
24
24
|
return send('model_name=', args.first.to_s) unless args.empty?
|
25
25
|
@model_name ||= default_model_name
|
26
26
|
end
|
27
|
+
alias_method('resource_name', 'model_name')
|
27
28
|
|
28
29
|
def model_name=(model_name)
|
29
30
|
@model_name = model_name_for(model_name)
|
30
31
|
end
|
32
|
+
alias_method('resource_name=', 'model_name=')
|
31
33
|
|
32
34
|
def model_name_for(model_name)
|
33
35
|
ActiveModel::Name.new(Map[:name, model_name])
|
data/lib/dao/errors.rb
CHANGED
data/lib/dao/form.rb
CHANGED
@@ -46,26 +46,21 @@ module Dao
|
|
46
46
|
|
47
47
|
fattr(:attributes) do
|
48
48
|
attributes =
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
end
|
65
|
-
if @object.respond_to?(:to_hash)
|
66
|
-
throw :attributes, Map.new(@object.to_hash)
|
67
|
-
end
|
68
|
-
Map.new
|
49
|
+
case
|
50
|
+
when @object.respond_to?(:attributes)
|
51
|
+
@object.attributes
|
52
|
+
when @object.instance_variable_defined?('@attributes')
|
53
|
+
@object.instance_variable_get('@attributes')
|
54
|
+
when @object.is_a?(Map)
|
55
|
+
@object
|
56
|
+
when @object.respond_to?(:to_map)
|
57
|
+
Map.new(@object.to_map)
|
58
|
+
when @object.is_a?(Hash)
|
59
|
+
Map.new(@object)
|
60
|
+
when @object.respond_to?(:to_hash)
|
61
|
+
Map.new(@object.to_hash)
|
62
|
+
else
|
63
|
+
Map.new
|
69
64
|
end
|
70
65
|
|
71
66
|
case attributes
|
@@ -103,14 +98,13 @@ module Dao
|
|
103
98
|
|
104
99
|
fattr(:errors) do
|
105
100
|
errors =
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
Errors.new
|
101
|
+
case
|
102
|
+
when @object.respond_to?(:errors)
|
103
|
+
@object.errors
|
104
|
+
when @object.instance_variable_defined?('@errors')
|
105
|
+
@object.instance_variable_get('@errors')
|
106
|
+
else
|
107
|
+
Errors.new
|
114
108
|
end
|
115
109
|
|
116
110
|
case errors
|
@@ -121,6 +115,25 @@ module Dao
|
|
121
115
|
end
|
122
116
|
end
|
123
117
|
|
118
|
+
fattr(:messages) do
|
119
|
+
messages =
|
120
|
+
case
|
121
|
+
when @object.respond_to?(:messages)
|
122
|
+
@object.messages
|
123
|
+
when @object.instance_variable_defined?('@messages')
|
124
|
+
@object.instance_variable_get('@messages')
|
125
|
+
else
|
126
|
+
Messages.new
|
127
|
+
end
|
128
|
+
|
129
|
+
case messages
|
130
|
+
when Messages
|
131
|
+
messages
|
132
|
+
else
|
133
|
+
raise(ArgumentError.new("#{ messages.inspect } (#{ messages.class })"))
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
124
137
|
# support for rails' forms...
|
125
138
|
#
|
126
139
|
fattr(:multipart){ true }
|
@@ -202,10 +215,14 @@ module Dao
|
|
202
215
|
|
203
216
|
def submit(*args, &block)
|
204
217
|
options = args.extract_options!.to_options!
|
218
|
+
keys = args.flatten
|
219
|
+
|
220
|
+
keys.push(:submit) if keys.empty?
|
221
|
+
name = options.delete(:name) || name_for(keys)
|
205
222
|
|
206
223
|
content = block ? block.call : (args.first || 'Submit')
|
207
224
|
|
208
|
-
options[:name] ||=
|
225
|
+
options[:name] ||= name
|
209
226
|
options[:type] ||= :submit
|
210
227
|
options[:value] ||= content
|
211
228
|
|
@@ -266,7 +283,7 @@ module Dao
|
|
266
283
|
id = options.delete(:id) || id_for(keys)
|
267
284
|
klass = class_for(keys, options.delete(:class))
|
268
285
|
error = error_for(keys, options.delete(:error))
|
269
|
-
values = options.delete(:values)
|
286
|
+
values = options.delete(:values)
|
270
287
|
|
271
288
|
unless options.has_key?(:checked)
|
272
289
|
checked = Coerce.boolean(attributes.get(keys))
|
data/lib/dao/messages.rb
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Dao
|
3
|
+
class Messages < ::Array
|
4
|
+
include Tagz.globally
|
5
|
+
|
6
|
+
class << Messages
|
7
|
+
include Tagz.globally
|
8
|
+
end
|
9
|
+
|
10
|
+
class Message < ::String
|
11
|
+
attr_accessor(:type)
|
12
|
+
|
13
|
+
def initialize(string, type = nil)
|
14
|
+
super("#{ string }")
|
15
|
+
ensure
|
16
|
+
@type = type ? "#{ type }" : nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_accessor :object
|
21
|
+
|
22
|
+
def initialize(*args)
|
23
|
+
@object = args.shift
|
24
|
+
end
|
25
|
+
|
26
|
+
def Messages.for(object)
|
27
|
+
new(object)
|
28
|
+
end
|
29
|
+
|
30
|
+
def Messages.to_html(*args, &block)
|
31
|
+
if block
|
32
|
+
define_method(:to_html, &block)
|
33
|
+
else
|
34
|
+
at_least_one = false
|
35
|
+
|
36
|
+
html =
|
37
|
+
div_(:class => "dao dao-messages"){
|
38
|
+
Messages.each(*args) do |message|
|
39
|
+
at_least_one = true
|
40
|
+
slug = Slug.for(message.type)
|
41
|
+
|
42
|
+
div_(:class => "dao dao-message alert alert-block alert-#{ slug }"){
|
43
|
+
tagz << Tagz.html_safe(message) << ' '
|
44
|
+
|
45
|
+
a_(:href => "#", :class => "close", :data_dismiss => "alert", :onClick => "javascript:$(this).closest('div').remove();false;"){
|
46
|
+
Tagz.html_safe('×')
|
47
|
+
}
|
48
|
+
}
|
49
|
+
end
|
50
|
+
}
|
51
|
+
|
52
|
+
at_least_one ? html : ''
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def to_html(*args)
|
57
|
+
Messages.to_html(self)
|
58
|
+
end
|
59
|
+
|
60
|
+
def to_s(*args)
|
61
|
+
to_html(*args)
|
62
|
+
end
|
63
|
+
|
64
|
+
def Messages.to_text(*args)
|
65
|
+
to_text = []
|
66
|
+
Messages.each(*args) do |message|
|
67
|
+
to_text.push([message.type, message].compact.join(': '))
|
68
|
+
end
|
69
|
+
to_text.join("\n")
|
70
|
+
end
|
71
|
+
|
72
|
+
def to_text
|
73
|
+
Messages.to_text(self)
|
74
|
+
end
|
75
|
+
|
76
|
+
def Messages.each(*args, &block)
|
77
|
+
args.flatten.compact.each do |arg|
|
78
|
+
message = arg.is_a?(Message) ? arg : Message.new(arg)
|
79
|
+
block.call(message)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def to_s(format = :html, *args, &block)
|
84
|
+
case format.to_s
|
85
|
+
when /html/
|
86
|
+
to_html(*args, &block)
|
87
|
+
when /text/
|
88
|
+
to_text(*args, &block)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def add(message, type = nil)
|
93
|
+
push(Message.new(message, type))
|
94
|
+
self
|
95
|
+
end
|
96
|
+
|
97
|
+
def method_missing(method, *args, &block)
|
98
|
+
if block.nil?
|
99
|
+
type = method.to_s
|
100
|
+
message = args.join
|
101
|
+
add(message, type)
|
102
|
+
else
|
103
|
+
super
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -18,103 +18,12 @@ if(!window.Dao){
|
|
18
18
|
};
|
19
19
|
Dao.Api.route = '/api';
|
20
20
|
Dao.Api.modes = ["options", "get", "head", "post", "put", "delete", "trace", "connect"];
|
21
|
-
|
22
|
-
// single call interface
|
23
|
-
//
|
24
|
-
Dao.Api.prototype.call = function(){
|
25
|
-
var api = this;
|
26
|
-
var options = {};
|
27
|
-
|
28
|
-
if(arguments.length == 1){
|
29
|
-
var arg = arguments[0];
|
30
|
-
|
31
|
-
if(typeof(arg)=='string'){
|
32
|
-
options.path = arg;
|
33
|
-
} else {
|
34
|
-
options = arg;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
if(arguments.length > 1){
|
39
|
-
options.path = arguments[0];
|
40
|
-
|
41
|
-
if(typeof(arguments[1])=='function'){
|
42
|
-
options.success = arguments[1];
|
43
|
-
options.params = arguments[2];
|
44
|
-
} else {
|
45
|
-
options.params = arguments[1];
|
46
|
-
options.success = arguments[2];
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
if(!options.path){
|
51
|
-
options.path = '/ping';
|
52
|
-
}
|
53
|
-
|
54
|
-
if(!options.params){
|
55
|
-
options.params = {};
|
56
|
-
}
|
57
|
-
|
58
|
-
var url = api.route + options.path;
|
59
|
-
var data = options.params;
|
60
|
-
|
61
|
-
if(options.success){
|
62
|
-
|
63
|
-
var returned = api;
|
64
|
-
var success = function(result){
|
65
|
-
var result = new Dao.Result(result);
|
66
|
-
options.success(result);
|
67
|
-
};
|
68
|
-
|
69
|
-
var ajax = {'url' : url, 'data' : data, 'success' : success, 'async' : true};
|
70
|
-
|
71
|
-
Dao[api.mode](ajax);
|
72
|
-
return(returned);
|
73
|
-
|
74
|
-
} else {
|
75
|
-
|
76
|
-
var returned = null;
|
77
|
-
var success = function(result){
|
78
|
-
returned = new Dao.Result(result);
|
79
|
-
};
|
80
|
-
|
81
|
-
var ajax = {'url' : url, 'data' : data, 'success' : success, 'async' : false};
|
82
|
-
|
83
|
-
Dao[api.mode](ajax);
|
84
|
-
return(returned);
|
85
|
-
|
86
|
-
};
|
87
|
-
};
|
88
|
-
Dao.Api.modes = ["options", "get", "head", "post", "put", "delete", "trace", "connect"];
|
89
21
|
Dao.Api.result = null;
|
90
22
|
Dao.Api.results = [];
|
91
23
|
Dao.Api.defaults = {};
|
92
24
|
Dao.Api.defaults.type = 'get';
|
93
25
|
Dao.Api.defaults.url = '/';
|
94
26
|
|
95
|
-
// meta-program Dao.Api.get(...), Dao.ajax.post(...)
|
96
|
-
//
|
97
|
-
for(var i = 0; i < Dao.Api.modes.length; i++){
|
98
|
-
(function(){
|
99
|
-
var mode = Dao.Api.modes[i];
|
100
|
-
|
101
|
-
Dao.Api.prototype[mode] = function(){
|
102
|
-
var args = Array.prototype.slice.call(arguments);
|
103
|
-
var api = this;
|
104
|
-
var default_type = Dao.Api.defaults.type;
|
105
|
-
Dao.Api.defaults.type = mode.toUpperCase();
|
106
|
-
var result = api.apply(api, args);
|
107
|
-
Dao.Api.defaults.type = default_type;
|
108
|
-
return(result);
|
109
|
-
};
|
110
|
-
})();
|
111
|
-
}
|
112
|
-
|
113
|
-
// short-cuts for read and write
|
114
|
-
//
|
115
|
-
Dao.Api.prototype['read'] = Dao.Api.prototype['get'];
|
116
|
-
Dao.Api.prototype['write'] = Dao.Api.prototype['post'];
|
117
|
-
|
118
27
|
// a thin wrapper on results for now. TODO - make it smarter
|
119
28
|
//
|
120
29
|
Dao.Result = function(options){
|
@@ -162,6 +71,90 @@ if(!window.Dao){
|
|
162
71
|
})();
|
163
72
|
}
|
164
73
|
|
74
|
+
// http method generator
|
75
|
+
//
|
76
|
+
Dao.Api.generate_method = function(mode){
|
77
|
+
var method = Dao[mode];
|
78
|
+
|
79
|
+
return function(){
|
80
|
+
var api = this;
|
81
|
+
var options = {};
|
82
|
+
|
83
|
+
if(arguments.length == 1){
|
84
|
+
var arg = arguments[0];
|
85
|
+
|
86
|
+
if(typeof(arg)=='string'){
|
87
|
+
options.path = arg;
|
88
|
+
} else {
|
89
|
+
options = arg;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
if(arguments.length > 1){
|
94
|
+
options.path = arguments[0];
|
95
|
+
|
96
|
+
if(typeof(arguments[1])=='function'){
|
97
|
+
options.success = arguments[1];
|
98
|
+
options.params = arguments[2];
|
99
|
+
} else {
|
100
|
+
options.params = arguments[1];
|
101
|
+
options.success = arguments[2];
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
if(!options.path){
|
106
|
+
options.path = '/ping';
|
107
|
+
}
|
108
|
+
|
109
|
+
if(!options.params){
|
110
|
+
options.params = {};
|
111
|
+
}
|
112
|
+
|
113
|
+
var url = api.route + options.path;
|
114
|
+
var data = options.params;
|
115
|
+
|
116
|
+
if(options.success){
|
117
|
+
|
118
|
+
var returned = api;
|
119
|
+
var success = function(result){
|
120
|
+
var result = new Dao.Result(result);
|
121
|
+
options.success(result);
|
122
|
+
};
|
123
|
+
|
124
|
+
var ajax = {'url' : url, 'data' : data, 'success' : success, 'async' : true};
|
125
|
+
|
126
|
+
method(ajax);
|
127
|
+
return(returned);
|
128
|
+
|
129
|
+
} else {
|
130
|
+
|
131
|
+
var returned = null;
|
132
|
+
var success = function(result){
|
133
|
+
returned = new Dao.Result(result);
|
134
|
+
};
|
135
|
+
|
136
|
+
var ajax = {'url' : url, 'data' : data, 'success' : success, 'async' : false};
|
137
|
+
|
138
|
+
method(ajax);
|
139
|
+
return(returned);
|
140
|
+
};
|
141
|
+
};
|
142
|
+
};
|
143
|
+
|
144
|
+
|
145
|
+
// meta-program Dao.Api.get(...), Dao.ajax.post(...)
|
146
|
+
//
|
147
|
+
for(var i = 0; i < Dao.Api.modes.length; i++){
|
148
|
+
(function(){
|
149
|
+
var mode = Dao.Api.modes[i];
|
150
|
+
Dao.Api.prototype[mode] = Dao.Api.generate_method(mode);
|
151
|
+
})();
|
152
|
+
}
|
153
|
+
Dao.Api.prototype['call'] = Dao.Api.prototype['get'];
|
154
|
+
Dao.Api.prototype['read'] = Dao.Api.prototype['get'];
|
155
|
+
Dao.Api.prototype['write'] = Dao.Api.prototype['post'];
|
156
|
+
|
157
|
+
|
165
158
|
Dao.api = new Dao.Api();
|
166
159
|
window.api = window.api || Dao.api;
|
167
160
|
}());
|
@@ -67,26 +67,21 @@ module Dao
|
|
67
67
|
|
68
68
|
def extract_attributes!(object = @object)
|
69
69
|
attributes =
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
end
|
86
|
-
if object.respond_to?(:to_hash)
|
87
|
-
throw :attributes, Map.new(object.to_hash)
|
88
|
-
end
|
89
|
-
raise ArgumentError.new("found no attributes on #{ object.inspect }(#{ object.class.name })")
|
70
|
+
case
|
71
|
+
when object.respond_to?(:attributes)
|
72
|
+
object.attributes
|
73
|
+
when object.instance_variable_defined?('@attributes')
|
74
|
+
object.instance_variable_get('@attributes')
|
75
|
+
when object.is_a?(Map)
|
76
|
+
object
|
77
|
+
when object.respond_to?(:to_map)
|
78
|
+
Map.new(object.to_map)
|
79
|
+
when object.is_a?(Hash)
|
80
|
+
Map.new(object)
|
81
|
+
when object.respond_to?(:to_hash)
|
82
|
+
Map.new(object.to_hash)
|
83
|
+
else
|
84
|
+
raise ArgumentError.new("found no attributes on #{ object.inspect }(#{ object.class.name })")
|
90
85
|
end
|
91
86
|
|
92
87
|
@attributes =
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dao
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ara T. Howard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 9.9.
|
75
|
+
version: 9.9.2
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 9.9.
|
82
|
+
version: 9.9.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: multi_json
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.
|
131
|
+
version: 1.8.0
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - ! '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.
|
138
|
+
version: 1.8.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rails_errors2html
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- lib/dao/extractor.rb
|
189
189
|
- lib/dao/form.rb
|
190
190
|
- lib/dao/instance_exec.rb
|
191
|
+
- lib/dao/messages.rb
|
191
192
|
- lib/dao/mode.rb
|
192
193
|
- lib/dao/mongo_mapper.rb
|
193
194
|
- lib/dao/name.rb
|