swift 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -45,6 +45,7 @@ gem install swift
45
45
 
46
46
  ```ruby
47
47
  require 'swift'
48
+ require 'swift/adapter/postgres'
48
49
 
49
50
  Swift.trace true # Debugging.
50
51
  Swift.setup :default, Swift::Adapter::Postgres, db: 'swift'
@@ -79,6 +80,7 @@ primitive Ruby type conversion.
79
80
 
80
81
  ```ruby
81
82
  require 'swift'
83
+ require 'swift/adapter/postgres'
82
84
  require 'swift/migrations'
83
85
 
84
86
  Swift.trace true # Debugging.
@@ -114,6 +116,7 @@ Record/relation level helpers.
114
116
 
115
117
  ```ruby
116
118
  require 'swift'
119
+ require 'swift/adapter/postgres'
117
120
  require 'swift/migrations'
118
121
 
119
122
  Swift.trace true # Debugging.
@@ -174,9 +177,12 @@ Swift comes with a simple identity map. Just require it after you load swift.
174
177
 
175
178
  ```ruby
176
179
  require 'swift'
180
+ require 'swift/adapter/postgres'
177
181
  require 'swift/identity_map'
178
182
  require 'swift/migrations'
179
183
 
184
+ Swift.setup :default, Swift::Adapter::Postgres, db: 'swift'
185
+
180
186
  class User < Swift::Record
181
187
  store :users
182
188
  attribute :id, Swift::Type::Integer, serial: true, key: true
@@ -213,6 +219,7 @@ But you can do it almost as fast in ruby,
213
219
 
214
220
  ```ruby
215
221
  require 'swift'
222
+ require 'swift/adapter/mysql'
216
223
 
217
224
  Swift.setup :default, Swift::Adapter::Mysql, db: 'swift'
218
225
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
data/lib/swift/result.rb CHANGED
@@ -17,7 +17,7 @@ module Swift
17
17
 
18
18
  def each
19
19
  @result.each do |tuple|
20
- yield @record.allocate.tap {|s| s.tuple = tuple}
20
+ yield @record.load(tuple)
21
21
  end
22
22
  end
23
23
  end # Result
data/swift.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "swift"
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Shane Hanna", "Bharanee 'Barney' Rathna"]
12
- s.date = "2012-08-01"
12
+ s.date = "2012-08-06"
13
13
  s.description = "A rational rudimentary database abstraction."
14
14
  s.email = ["shane.hanna@gmail.com", "deepfryed@gmail.com"]
15
15
  s.extra_rdoc_files = [
@@ -59,7 +59,7 @@ Gem::Specification.new do |s|
59
59
  ]
60
60
  s.homepage = "http://github.com/shanna/swift"
61
61
  s.require_paths = ["lib"]
62
- s.rubygems_version = "1.8.23"
62
+ s.rubygems_version = "1.8.24"
63
63
  s.summary = "A rational rudimentary database abstraction."
64
64
 
65
65
  if s.respond_to? :specification_version then
data/test/test_record.rb CHANGED
@@ -96,6 +96,13 @@ describe 'record' do
96
96
  assert user.update(name: 'dave')
97
97
  assert user.delete
98
98
  end
99
+
100
+ it 'should use Record.load to create new instances from database' do
101
+ klass = Class.new(@user) { def self.load tuple; super.tap {|i| i.tuple[:name] = 'test'}; end }
102
+ user = klass.create(name: 'dan')
103
+ user = klass.get(id: user.id)
104
+ assert_equal 'test', user.name
105
+ end
99
106
  end
100
107
  end
101
108
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swift
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-01 00:00:00.000000000 Z
13
+ date: 2012-08-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  requirements: []
99
99
  rubyforge_project:
100
- rubygems_version: 1.8.23
100
+ rubygems_version: 1.8.24
101
101
  signing_key:
102
102
  specification_version: 3
103
103
  summary: A rational rudimentary database abstraction.