activerecord-tableless 1.3.2 → 1.3.3
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 +4 -4
- data/activerecord-tableless.gemspec +2 -2
- data/lib/activerecord-tableless.rb +12 -39
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 95f9af991df787914a130934cbeec6166323d040
|
|
4
|
+
data.tar.gz: 952995596bbf42b852ffd7cba372bec6cc3732a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9809a4c671fe0d7cb0ff53605a181f797ae4c9ad7c268dc4d738df9531d6a28ef2893bc624bafc5040ee08ec6cfc934b46ef9cb12dd04006cc64bc5287ed130e
|
|
7
|
+
data.tar.gz: 71e3c7263f7a52ac49c3d78038663e8d51173149c01d8f76c7b24ad4ffc7907dff4bcad7b06bc647d2de427eae362ac7763900324da613d9c6de2328ebda345c
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |gem|
|
|
4
4
|
gem.name = 'activerecord-tableless'
|
|
5
|
-
gem.version = "1.3.
|
|
5
|
+
gem.version = "1.3.3"
|
|
6
6
|
gem.platform = Gem::Platform::RUBY
|
|
7
7
|
gem.authors = ["Jarl Friis", "Kenneth Kalmer", "Michal Zima"]
|
|
8
8
|
gem.email = ["jarl@softace.dk"]
|
|
9
9
|
gem.homepage = "https://github.com/softace/activerecord-tableless"
|
|
10
10
|
gem.summary = %q{A library for implementing tableless ActiveRecord models}
|
|
11
|
-
gem.description = %q{ActiveRecord Tableless Models provides a simple mixin for creating models that are not bound to the database. This approach is
|
|
11
|
+
gem.description = %q{ActiveRecord Tableless Models provides a simple mixin for creating models that are not bound to the database. This approach is useful for taking advantage of the features of ActiveRecord such as validation, relationships, etc.}
|
|
12
12
|
gem.license = 'MIT'
|
|
13
13
|
|
|
14
14
|
gem.files = `git ls-files`.split($\)
|
|
@@ -29,10 +29,8 @@ module ActiveRecord
|
|
|
29
29
|
#
|
|
30
30
|
module Tableless
|
|
31
31
|
|
|
32
|
-
class
|
|
33
|
-
end
|
|
34
|
-
class NoDatabase < Exception
|
|
35
|
-
end
|
|
32
|
+
class NoDatabase < StandardError; end
|
|
33
|
+
class Unsupported < StandardError; end
|
|
36
34
|
|
|
37
35
|
def self.included( base ) #:nodoc:
|
|
38
36
|
base.send :extend, ActsMethods
|
|
@@ -59,7 +57,7 @@ module ActiveRecord
|
|
|
59
57
|
:columns => []
|
|
60
58
|
}
|
|
61
59
|
else
|
|
62
|
-
raise
|
|
60
|
+
raise Unsupported.new("Sorry, ActiveRecord version #{ActiveRecord::VERSION::STRING} is not supported")
|
|
63
61
|
end
|
|
64
62
|
|
|
65
63
|
# extend
|
|
@@ -157,7 +155,7 @@ module ActiveRecord
|
|
|
157
155
|
|
|
158
156
|
end
|
|
159
157
|
else
|
|
160
|
-
raise
|
|
158
|
+
raise Unsupported.new("Unsupported ActiveRecord version")
|
|
161
159
|
end
|
|
162
160
|
|
|
163
161
|
def transaction(&block)
|
|
@@ -230,39 +228,14 @@ module ActiveRecord
|
|
|
230
228
|
""
|
|
231
229
|
end
|
|
232
230
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
def create_record(*args)
|
|
243
|
-
case self.class.tableless_options[:database]
|
|
244
|
-
when :pretend_success
|
|
245
|
-
true
|
|
246
|
-
when :fail_fast
|
|
247
|
-
raise NoDatabase.new("Can't #create_record a Tableless object")
|
|
248
|
-
end
|
|
249
|
-
end
|
|
250
|
-
|
|
251
|
-
def update(*args)
|
|
252
|
-
case self.class.tableless_options[:database]
|
|
253
|
-
when :pretend_success
|
|
254
|
-
true
|
|
255
|
-
when :fail_fast
|
|
256
|
-
raise NoDatabase.new("Can't #update a Tableless object")
|
|
257
|
-
end
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
def update_record(*args)
|
|
261
|
-
case self.class.tableless_options[:database]
|
|
262
|
-
when :pretend_success
|
|
263
|
-
true
|
|
264
|
-
when :fail_fast
|
|
265
|
-
raise NoDatabase.new("Can't #update_record a Tableless object")
|
|
231
|
+
%w(create create_record update update_record).each do |method_name|
|
|
232
|
+
define_method(method_name) do |*args|
|
|
233
|
+
case self.class.tableless_options[:database]
|
|
234
|
+
when :pretend_success
|
|
235
|
+
true
|
|
236
|
+
when :fail_fast
|
|
237
|
+
raise NoDatabase.new("Can't ##{method_name} a Tableless object")
|
|
238
|
+
end
|
|
266
239
|
end
|
|
267
240
|
end
|
|
268
241
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord-tableless
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jarl Friis
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2013-10-
|
|
13
|
+
date: 2013-10-03 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activerecord
|
|
@@ -167,8 +167,8 @@ dependencies:
|
|
|
167
167
|
- !ruby/object:Gem::Version
|
|
168
168
|
version: '2.1'
|
|
169
169
|
description: ActiveRecord Tableless Models provides a simple mixin for creating models
|
|
170
|
-
that are not bound to the database. This approach is
|
|
171
|
-
|
|
170
|
+
that are not bound to the database. This approach is useful for taking advantage
|
|
171
|
+
of the features of ActiveRecord such as validation, relationships, etc.
|
|
172
172
|
email:
|
|
173
173
|
- jarl@softace.dk
|
|
174
174
|
executables: []
|