abstraction 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Rakefile +1 -0
- data/VERSION.yml +3 -2
- data/lib/abstraction.rb +6 -6
- metadata +7 -5
- data/spec/spec.opts +0 -1
data/.gitignore
ADDED
data/Rakefile
CHANGED
@@ -8,6 +8,7 @@ begin
|
|
8
8
|
s.homepage = "http://github.com/Peeja/abstraction"
|
9
9
|
s.rubyforge_project = "abstraction"
|
10
10
|
end
|
11
|
+
Jeweler::GemcutterTasks.new
|
11
12
|
rescue LoadError
|
12
13
|
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
13
14
|
end
|
data/VERSION.yml
CHANGED
data/lib/abstraction.rb
CHANGED
@@ -2,26 +2,26 @@ class AbstractClassError < StandardError; end
|
|
2
2
|
|
3
3
|
class Class
|
4
4
|
def abstract
|
5
|
-
@
|
6
|
-
|
5
|
+
@abstraction_abstract_class = true
|
6
|
+
|
7
7
|
self.extend Module.new {
|
8
8
|
def new(*args, &block)
|
9
|
-
if @
|
9
|
+
if @abstraction_abstract_class
|
10
10
|
raise AbstractClassError, "#{self} is an abstract class and cannot be instantiated"
|
11
11
|
else
|
12
12
|
super *args, &block
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def allocate(*args, &block)
|
17
|
-
if @
|
17
|
+
if @abstraction_abstract_class
|
18
18
|
raise AbstractClassError, "#{self} is an abstract class and cannot be instantiated"
|
19
19
|
else
|
20
20
|
super *args, &block
|
21
21
|
end
|
22
22
|
end
|
23
23
|
}
|
24
|
-
|
24
|
+
|
25
25
|
nil
|
26
26
|
end
|
27
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abstraction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Jaros
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-01 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -22,6 +22,7 @@ extensions: []
|
|
22
22
|
extra_rdoc_files:
|
23
23
|
- README.markdown
|
24
24
|
files:
|
25
|
+
- .gitignore
|
25
26
|
- History.txt
|
26
27
|
- README.markdown
|
27
28
|
- Rakefile
|
@@ -29,9 +30,10 @@ files:
|
|
29
30
|
- examples/cars.rb
|
30
31
|
- lib/abstraction.rb
|
31
32
|
- spec/abstraction_spec.rb
|
32
|
-
- spec/spec.opts
|
33
33
|
has_rdoc: true
|
34
34
|
homepage: http://github.com/Peeja/abstraction
|
35
|
+
licenses: []
|
36
|
+
|
35
37
|
post_install_message:
|
36
38
|
rdoc_options:
|
37
39
|
- --charset=UTF-8
|
@@ -52,9 +54,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
54
|
requirements: []
|
53
55
|
|
54
56
|
rubyforge_project: abstraction
|
55
|
-
rubygems_version: 1.3.
|
57
|
+
rubygems_version: 1.3.5
|
56
58
|
signing_key:
|
57
|
-
specification_version:
|
59
|
+
specification_version: 3
|
58
60
|
summary: Abstract classes for Ruby
|
59
61
|
test_files:
|
60
62
|
- spec/abstraction_spec.rb
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|