activerecord-tableless 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3ec8ac59ad50cf82c6e28104fc4140735c17e5d
4
- data.tar.gz: d3c110aecfcd36f01fc79286df4884bf868e41c6
3
+ metadata.gz: 95f9af991df787914a130934cbeec6166323d040
4
+ data.tar.gz: 952995596bbf42b852ffd7cba372bec6cc3732a0
5
5
  SHA512:
6
- metadata.gz: 5f0b9726ed60d31cefd04ba7699287fa963b3bcf79d98b54fa48dc0f8e9436f1cc8a63e5410ed81a761accd3cfe8659fef58bed4b4cb6d150ebb2141b434bf4a
7
- data.tar.gz: 17eaf1ab787e23b71a40bfa2742983c3ba952904924b41ad3ccd88decbabedac494fd6859437c30fa32aeefd646512bcdc01895431e7d332f2e5c8e184bb181d
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.2"
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 mostly useful for capitalizing on the features ActiveRecord::Validation}
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 Exception < StandardError
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 Exception.new("Sorry, ActiveRecord version #{ActiveRecord::VERSION::STRING} is not supported")
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 Exception.new("Unsupported ActiveRecord version")
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
- def create(*args)
234
- case self.class.tableless_options[:database]
235
- when :pretend_success
236
- true
237
- when :fail_fast
238
- raise NoDatabase.new("Can't #create a Tableless object")
239
- end
240
- end
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.2
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-02 00:00:00.000000000 Z
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 mostly useful for capitalizing
171
- on the features ActiveRecord::Validation
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: []