bsm-models 0.8.2 → 0.9.0

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: 11eef4d80f56cff8b1b506c3fc0cab7baa02bc44
4
- data.tar.gz: aa9ecce0aeda15784eb039dee0d3e2cd8e01e947
3
+ metadata.gz: 68a107120c0c5f44c411f7447348323a7c0ca6ee
4
+ data.tar.gz: ae4e2a600e05ce1eb233affd003e21ebcea2ceca
5
5
  SHA512:
6
- metadata.gz: 5308585af871ea5c48d77178393c65ec996033bbc50289f21f542b244ba7ad9d24e18be8247b3d2c9d5b2a8fcbf0bbbf5c117a987b4c9dc38da8acadec6f8ed5
7
- data.tar.gz: 4f95845c5d3d2f0e99599a2f8d29b6cc1afef1c069d0ec08da256f439d2b40320dcf3e9f9cf8815d47f468f09e6e574f808f296190d7d993835e2292f1f4bc01
6
+ metadata.gz: d82015d125b38b3185e0ac731884b1082b8d1780210c30f2eef49a621f694c8f0cad045e858225c6f74f2d80a582c35875b9cd568d0a58aabdb2ac19bf848980
7
+ data.tar.gz: 33e2006f7fe15c1eed43d92fd4897ed571b542ada330461c4390f3676769f42f94900ad3edc80293175857f9b288fc6a98efa7b1dfb357dd9748d337a3026fd3
@@ -36,7 +36,7 @@ class Bsm::Model::Coders::AbstractColumn
36
36
  protected
37
37
 
38
38
  def _load(string)
39
- not_implemented
39
+ raise NotImplementedError
40
40
  end
41
41
 
42
42
  end
@@ -2,11 +2,17 @@ module Bsm::Model::Deletable
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- before_destroy :deletable?
5
+ before_destroy :check_deletable?
6
6
  end
7
7
 
8
8
  def deletable?
9
- not_implemented
9
+ raise NotImplementedError
10
+ end
11
+
12
+ private
13
+
14
+ def check_deletable?
15
+ throw :abort unless deletable?
10
16
  end
11
17
 
12
18
  end
@@ -7,7 +7,7 @@ module Bsm::Model::Editable
7
7
  end
8
8
 
9
9
  def editable?
10
- not_implemented
10
+ raise NotImplementedError
11
11
  end
12
12
 
13
13
  def immutable?
@@ -20,4 +20,4 @@ module Bsm::Model::Editable
20
20
  errors.add :base, :immutable if immutable?
21
21
  end
22
22
 
23
- end
23
+ end
@@ -43,7 +43,7 @@ module Bsm::Model::HasManySerialized
43
43
  end
44
44
  end
45
45
 
46
- def macro
46
+ def self.macro
47
47
  :has_many
48
48
  end
49
49
 
@@ -14,16 +14,11 @@ module Bsm::Model::StiConvertable
14
14
  yield
15
15
  end
16
16
 
17
- # AR <4.0 compatibility
18
- def self.scoping(klass, current_scope, &block)
19
- klass.send(:with_scope, current_scope, &block)
20
- end if ActiveRecord::VERSION::MAJOR < 4
21
-
22
17
  module ClassMethods
23
18
 
24
19
  # @Override: Allow to specify a kind
25
20
  def new(attributes = nil, *args, &block)
26
- kind = (attributes = attributes.with_indifferent_access).delete(:kind) if attributes.is_a?(Hash)
21
+ kind = attributes.delete(:kind) { attributes.delete('kind') } if attributes.respond_to?(:delete)
27
22
  return super if real_type?
28
23
 
29
24
  klass = real_descendants.find {|k| k.kind == kind } || fallback_descendant
data/lib/bsm/model.rb CHANGED
@@ -1,4 +1,7 @@
1
- require 'rails'
1
+ begin
2
+ require 'rails'
3
+ rescue LoadError
4
+ end
2
5
 
3
6
  module Bsm
4
7
  module Model
@@ -14,5 +17,5 @@ module Bsm
14
17
  class Railtie < ::Rails::Railtie
15
18
  require 'active_support/i18n'
16
19
  I18n.load_path << File.expand_path('../model/locale/en.yml', __FILE__)
17
- end
18
- end
20
+ end if defined?(::Rails::Railtie)
21
+ end
metadata CHANGED
@@ -1,71 +1,51 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bsm-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-05 00:00:00.000000000 Z
11
+ date: 2017-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: abstract
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: activerecord
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: 4.1.0
19
+ version: '5.0'
34
20
  - - "<"
35
21
  - !ruby/object:Gem::Version
36
- version: 5.0.0
22
+ version: '5.1'
37
23
  type: :runtime
38
24
  prerelease: false
39
25
  version_requirements: !ruby/object:Gem::Requirement
40
26
  requirements:
41
27
  - - ">="
42
28
  - !ruby/object:Gem::Version
43
- version: 4.1.0
29
+ version: '5.0'
44
30
  - - "<"
45
31
  - !ruby/object:Gem::Version
46
- version: 5.0.0
32
+ version: '5.1'
47
33
  - !ruby/object:Gem::Dependency
48
- name: railties
34
+ name: rspec
49
35
  requirement: !ruby/object:Gem::Requirement
50
36
  requirements:
51
37
  - - ">="
52
38
  - !ruby/object:Gem::Version
53
- version: 4.1.0
54
- - - "<"
55
- - !ruby/object:Gem::Version
56
- version: 5.0.0
57
- type: :runtime
39
+ version: '0'
40
+ type: :development
58
41
  prerelease: false
59
42
  version_requirements: !ruby/object:Gem::Requirement
60
43
  requirements:
61
44
  - - ">="
62
45
  - !ruby/object:Gem::Version
63
- version: 4.1.0
64
- - - "<"
65
- - !ruby/object:Gem::Version
66
- version: 5.0.0
46
+ version: '0'
67
47
  - !ruby/object:Gem::Dependency
68
- name: rspec
48
+ name: rspec-its
69
49
  requirement: !ruby/object:Gem::Requirement
70
50
  requirements:
71
51
  - - ">="
@@ -79,7 +59,7 @@ dependencies:
79
59
  - !ruby/object:Gem::Version
80
60
  version: '0'
81
61
  - !ruby/object:Gem::Dependency
82
- name: rspec-its
62
+ name: sqlite3
83
63
  requirement: !ruby/object:Gem::Requirement
84
64
  requirements:
85
65
  - - ">="
@@ -93,7 +73,7 @@ dependencies:
93
73
  - !ruby/object:Gem::Version
94
74
  version: '0'
95
75
  - !ruby/object:Gem::Dependency
96
- name: sqlite3
76
+ name: shoulda-matchers
97
77
  requirement: !ruby/object:Gem::Requirement
98
78
  requirements:
99
79
  - - ">="
@@ -107,7 +87,7 @@ dependencies:
107
87
  - !ruby/object:Gem::Version
108
88
  version: '0'
109
89
  - !ruby/object:Gem::Dependency
110
- name: shoulda-matchers
90
+ name: railties
111
91
  requirement: !ruby/object:Gem::Requirement
112
92
  requirements:
113
93
  - - ">="
@@ -159,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
139
  version: 1.8.0
160
140
  requirements: []
161
141
  rubyforge_project:
162
- rubygems_version: 2.4.3
142
+ rubygems_version: 2.5.2
163
143
  signing_key:
164
144
  specification_version: 4
165
145
  summary: BSM's very custom model extensions