acts_as_interface 0.1.4 → 0.1.5
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/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/acts_as_interface.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{acts_as_interface}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Philippe Huibonhoa"]
|
@@ -25,8 +25,8 @@ Gem::Specification.new do |s|
|
|
25
25
|
"VERSION",
|
26
26
|
"acts_as_interface.gemspec",
|
27
27
|
"lib/acts_as_interface.rb",
|
28
|
-
"test/
|
29
|
-
"test/
|
28
|
+
"test/acts_as_interface_test.rb",
|
29
|
+
"test/helper.rb"
|
30
30
|
]
|
31
31
|
s.homepage = %q{http://github.com/phuibonhoa/acts_as_interface}
|
32
32
|
s.licenses = ["MIT"]
|
@@ -34,8 +34,8 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.rubygems_version = %q{1.3.7}
|
35
35
|
s.summary = %q{Easily define abstract methods and callbacks for superclasses and modules}
|
36
36
|
s.test_files = [
|
37
|
-
"test/
|
38
|
-
"test/
|
37
|
+
"test/acts_as_interface_test.rb",
|
38
|
+
"test/helper.rb"
|
39
39
|
]
|
40
40
|
|
41
41
|
if s.respond_to? :specification_version then
|
data/lib/acts_as_interface.rb
CHANGED
@@ -32,8 +32,14 @@ require 'active_support'
|
|
32
32
|
# end
|
33
33
|
class Object
|
34
34
|
def define_abstract_method(abstract_method_name, options)
|
35
|
-
model_columns
|
36
|
-
|
35
|
+
model_columns = []
|
36
|
+
error_on_column_load = false
|
37
|
+
begin
|
38
|
+
model_columns = respond_to?(:columns) ? columns : []
|
39
|
+
rescue
|
40
|
+
error_on_column_load = true
|
41
|
+
end
|
42
|
+
|
37
43
|
unless method_defined?(abstract_method_name) or error_on_column_load or model_columns.any? { |column| column.name.to_sym == abstract_method_name }
|
38
44
|
define_method(abstract_method_name) do |*abstract_method_args|
|
39
45
|
if options.has_key?(:default)
|
File without changes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_interface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Philippe Huibonhoa
|
@@ -128,8 +128,8 @@ files:
|
|
128
128
|
- VERSION
|
129
129
|
- acts_as_interface.gemspec
|
130
130
|
- lib/acts_as_interface.rb
|
131
|
+
- test/acts_as_interface_test.rb
|
131
132
|
- test/helper.rb
|
132
|
-
- test/test_acts_as_interface.rb
|
133
133
|
has_rdoc: true
|
134
134
|
homepage: http://github.com/phuibonhoa/acts_as_interface
|
135
135
|
licenses:
|
@@ -165,5 +165,5 @@ signing_key:
|
|
165
165
|
specification_version: 3
|
166
166
|
summary: Easily define abstract methods and callbacks for superclasses and modules
|
167
167
|
test_files:
|
168
|
+
- test/acts_as_interface_test.rb
|
168
169
|
- test/helper.rb
|
169
|
-
- test/test_acts_as_interface.rb
|