abstract_method 1.1.0 → 1.2.0
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/README.md +20 -8
- data/VERSION +1 -1
- metadata +9 -7
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
Abstract Method
|
2
2
|
===============
|
3
3
|
|
4
|
-
Abstract Method is a tiny library enabling you to define abstract methods in
|
4
|
+
Abstract Method is a tiny library enabling you to define abstract methods in
|
5
|
+
Ruby classes and modules.
|
5
6
|
|
6
7
|
Example
|
7
8
|
-------
|
@@ -35,7 +36,8 @@ First, require the library:
|
|
35
36
|
require "abstract_method"
|
36
37
|
```
|
37
38
|
|
38
|
-
You can now use the `abstract_method` method to define abstract methods in
|
39
|
+
You can now use the `abstract_method` method to define abstract methods in
|
40
|
+
classes and modules.
|
39
41
|
|
40
42
|
```ruby
|
41
43
|
class AbstractClass
|
@@ -47,7 +49,8 @@ class AbstractModule
|
|
47
49
|
end
|
48
50
|
```
|
49
51
|
|
50
|
-
When called, the abstract method will raise an `AbstractMethodCalled` exception
|
52
|
+
When called, the abstract method will raise an `AbstractMethodCalled` exception
|
53
|
+
with a helpful message:
|
51
54
|
|
52
55
|
```ruby
|
53
56
|
AbstractClass.new.foo # raises AbstractMethodCalled with the following message:
|
@@ -67,15 +70,24 @@ end
|
|
67
70
|
ConcreteClass.new.foo # => 42
|
68
71
|
```
|
69
72
|
|
70
|
-
For more information, see the [API
|
73
|
+
For more information, see the [API
|
74
|
+
documentation](http://rubydoc.info/github/openSUSE/abstract_method/frames).
|
71
75
|
|
72
76
|
FAQ
|
73
77
|
---
|
74
78
|
|
75
|
-
**Why define abstract methods? In a dynamic language like Ruby they aren't
|
79
|
+
**Why define abstract methods? In a dynamic language like Ruby they aren't
|
80
|
+
needed.**
|
76
81
|
|
77
|
-
Mainly for documentation purposes. The definitions allow subclass authors to
|
82
|
+
Mainly for documentation purposes. The definitions allow subclass authors to
|
83
|
+
easily see what they need to implement. They are also a great place to attach
|
84
|
+
documentation.
|
78
85
|
|
79
|
-
**Why create a new library? There is already the
|
86
|
+
**Why create a new library? There is already the
|
87
|
+
[abstract](http://rubygems.org/gems/abstract) gem.**
|
80
88
|
|
81
|
-
With the abstract gem you have to specify the abstract method parameter list in
|
89
|
+
With the abstract gem you have to specify the abstract method parameter list in
|
90
|
+
a string when you define it. This is ugly and in Ruby the parameter list often
|
91
|
+
does not say much about the method anyway. The parameters should should rather
|
92
|
+
be described using a code documentation system (such as
|
93
|
+
[YARD](http://yardoc.org/)).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abstract_method
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Majda
|
@@ -15,7 +15,8 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-06-18 00:00:00 +02:00
|
19
|
+
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rspec
|
@@ -32,7 +33,7 @@ dependencies:
|
|
32
33
|
type: :development
|
33
34
|
version_requirements: *id001
|
34
35
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
36
|
+
name: yard
|
36
37
|
prerelease: false
|
37
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
39
|
none: false
|
@@ -46,7 +47,7 @@ dependencies:
|
|
46
47
|
type: :development
|
47
48
|
version_requirements: *id002
|
48
49
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
50
|
+
name: redcarpet
|
50
51
|
prerelease: false
|
51
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
53
|
none: false
|
@@ -72,6 +73,7 @@ files:
|
|
72
73
|
- README.md
|
73
74
|
- VERSION
|
74
75
|
- lib/abstract_method.rb
|
76
|
+
has_rdoc: true
|
75
77
|
homepage: https://github.com/openSUSE/abstract_method
|
76
78
|
licenses:
|
77
79
|
- MIT
|
@@ -101,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
103
|
requirements: []
|
102
104
|
|
103
105
|
rubyforge_project:
|
104
|
-
rubygems_version: 1.
|
106
|
+
rubygems_version: 1.6.2
|
105
107
|
signing_key:
|
106
108
|
specification_version: 3
|
107
109
|
summary: Tiny library enabling you to define abstract methods in Ruby classes and modules
|