sequel 0.0.12 → 0.0.13
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.
- data/CHANGELOG +6 -0
- data/Rakefile +1 -1
- data/lib/sequel/dataset.rb +1 -1
- data/lib/sequel/model.rb +4 -11
- metadata +8 -8
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
*0.0.13*
|
2
|
+
|
3
|
+
* Fixed Model#method_missing to do both find, filter and attribute accessors. duh.
|
4
|
+
|
5
|
+
* Fixed bug in Dataset#literal when quoting arrays of strings (thanks Douglas Koszerek.)
|
6
|
+
|
1
7
|
*0.0.12*
|
2
8
|
|
3
9
|
* Model#save now correctly performs an INSERT for new objects.
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ require 'fileutils'
|
|
6
6
|
include FileUtils
|
7
7
|
|
8
8
|
NAME = "sequel"
|
9
|
-
VERS = "0.0.
|
9
|
+
VERS = "0.0.13"
|
10
10
|
CLEAN.include ['**/.*.sw?', 'pkg/*', '.config', 'doc/*', 'coverage/*']
|
11
11
|
RDOC_OPTS = ['--quiet', '--title', "Sequel: Concise ORM for Ruby",
|
12
12
|
"--opname", "index.html",
|
data/lib/sequel/dataset.rb
CHANGED
@@ -113,7 +113,7 @@ module Sequel
|
|
113
113
|
when Integer, Float: v.to_s
|
114
114
|
when NilClass: NULL
|
115
115
|
when Symbol: v.to_field_name
|
116
|
-
when Array: v.empty? ? NULL : v.join(COMMA_SEPARATOR)
|
116
|
+
when Array: v.empty? ? NULL : v.map {|i| literal(i)}.join(COMMA_SEPARATOR)
|
117
117
|
else
|
118
118
|
raise "can't express #{v.inspect}:#{v.class} as a SQL literal"
|
119
119
|
end
|
data/lib/sequel/model.rb
CHANGED
@@ -195,6 +195,7 @@ module Sequel
|
|
195
195
|
|
196
196
|
FIND_BY_REGEXP = /^find_by_(.*)/.freeze
|
197
197
|
FILTER_BY_REGEXP = /^filter_by_(.*)/.freeze
|
198
|
+
WRITE_ATTR_REGEXP = /(.*)=$/.freeze
|
198
199
|
|
199
200
|
def self.method_missing(m, *args)
|
200
201
|
Thread.exclusive do
|
@@ -207,24 +208,16 @@ module Sequel
|
|
207
208
|
c = $1
|
208
209
|
meta_def(method_name) {|arg| filter(c => arg)}
|
209
210
|
send(m, *args) if respond_to?(m)
|
211
|
+
elsif method_name =~ WRITE_ATTR_REGEXP
|
212
|
+
self[$1.to_sym] = value
|
210
213
|
else
|
211
|
-
|
214
|
+
self[m]
|
212
215
|
end
|
213
216
|
end
|
214
217
|
end
|
215
218
|
|
216
219
|
def db; @@db; end
|
217
220
|
|
218
|
-
ASSIGN_METHOD_REGEXP = /(.*)=$/.freeze
|
219
|
-
|
220
|
-
def method_missing(sym, value = nil)
|
221
|
-
if sym.to_s =~ ASSIGN_METHOD_REGEXP
|
222
|
-
@values[$1.to_sym] = value
|
223
|
-
else
|
224
|
-
@values[sym]
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
221
|
def reload
|
229
222
|
temp = self.class[@pkey]
|
230
223
|
@values = self.class.dataset.naked[primary_key => @pkey]
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: sequel
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-03-
|
6
|
+
version: 0.0.13
|
7
|
+
date: 2007-03-28 00:00:00 +02:00
|
8
8
|
summary: Concise ORM for Ruby.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -36,16 +36,16 @@ files:
|
|
36
36
|
- doc/rdoc
|
37
37
|
- lib/sequel
|
38
38
|
- lib/sequel.rb
|
39
|
-
- lib/sequel/connection_pool.rb
|
40
|
-
- lib/sequel/core_ext.rb
|
41
|
-
- lib/sequel/database.rb
|
42
39
|
- lib/sequel/dataset.rb
|
43
40
|
- lib/sequel/model.rb
|
44
|
-
- lib/sequel/mysql.rb
|
45
41
|
- lib/sequel/postgres.rb
|
46
|
-
- lib/sequel/pretty_table.rb
|
47
42
|
- lib/sequel/schema.rb
|
48
43
|
- lib/sequel/sqlite.rb
|
44
|
+
- lib/sequel/connection_pool.rb
|
45
|
+
- lib/sequel/database.rb
|
46
|
+
- lib/sequel/core_ext.rb
|
47
|
+
- lib/sequel/mysql.rb
|
48
|
+
- lib/sequel/pretty_table.rb
|
49
49
|
- CHANGELOG
|
50
50
|
test_files: []
|
51
51
|
|