class_interface 0.1.3 → 1.0.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.
- checksums.yaml +4 -4
- data/README.md +35 -8
- data/lib/class_interface/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3eabbe0ac8631de63b8e3e977b79b90f3ec76239801a5d1fa9928d95ed44a737
|
4
|
+
data.tar.gz: 472e2de7c4ae9b9551dbf696fd317d1a7b7d43999ba0b8b9378c301f74cd628b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22d6e41200db86d91320068859bf396ae5e3546a318eee8096bfac6f0ce05d3cb846598bc4daa2b4f7f5def6f14a995f13e768637c3ed03173c9685590077a6d
|
7
|
+
data.tar.gz: 8f4cdc84cd6a8f5ffbaaeaf5e590283d12893f44470c2776c3cc83e2afa7919939fc60c8864a48ed77c36283e6e1a4649c1bc4dc1f2972bf2b67daf44bf04975
|
data/README.md
CHANGED
@@ -1,9 +1,22 @@
|
|
1
|
-
#
|
1
|
+
# class_interface
|
2
2
|
|
3
|
-
|
3
|
+
Ruby gem to extend Ruby to support class interfaces you may know them from other programming languages like C++ or Java.
|
4
4
|
|
5
|
-
|
5
|
+
Raises a variety of different exceptions when the requirements of the interface are not met.
|
6
6
|
|
7
|
+
That can be very handy in teams to declare requirements for specific types of classes.
|
8
|
+
|
9
|
+
# Contents
|
10
|
+
|
11
|
+
* [Installation](#installation)
|
12
|
+
* [Usage](#usage)
|
13
|
+
* [Documentation](#documentation)
|
14
|
+
* [Contributing](#contributing)
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
<a name="installation"></a>
|
7
20
|
## Installation
|
8
21
|
|
9
22
|
Add this line to your application's Gemfile:
|
@@ -19,8 +32,12 @@ And then execute:
|
|
19
32
|
Or install it yourself as:
|
20
33
|
|
21
34
|
$ gem install class_interface
|
22
|
-
|
23
|
-
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
<a name="usage"></a>
|
40
|
+
## Usage
|
24
41
|
|
25
42
|
### Defining an interface
|
26
43
|
|
@@ -68,6 +85,11 @@ class MyImplementation
|
|
68
85
|
end
|
69
86
|
```
|
70
87
|
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<a name="documentation"></a>
|
71
93
|
## Documentation
|
72
94
|
```ruby
|
73
95
|
#implements(InterfaceClassConstant)
|
@@ -78,16 +100,21 @@ _InterfaceClassConstant_ must be a valid InterfaceClassConstant or a String, con
|
|
78
100
|
### Methods
|
79
101
|
|
80
102
|
All defined methods in the interface class must be implemented in the implementing class.
|
81
|
-
The parameter count must be the same.
|
103
|
+
The parameter count must be the same. A distinction is made between static and dynamic methods.
|
82
104
|
|
83
105
|
### Constant Types
|
84
106
|
|
85
107
|
All CONSTANTS defined in the interface class must be implemented in the implementing class.
|
86
|
-
CONSTANTS of interfaces may be defined
|
108
|
+
CONSTANTS of interfaces may be defined with `nil`, to allow all types of definitions in the implementing class.
|
87
109
|
|
88
|
-
|
110
|
+
Otherwise to specify a type, assign its class constant, e.g. `String`, `Array`, `MyCustomClass`, ...
|
89
111
|
If a specified type is defined, it is mandatory for the implementation to use that type.
|
90
112
|
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<a name="contributing"></a>
|
91
118
|
## Contributing
|
92
119
|
|
93
120
|
Bug reports and pull requests are welcome on GitHub at https://github.com/magynhard/class_interface. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: class_interface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthäus Beyrle
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
rubygems_version: 3.
|
100
|
+
rubygems_version: 3.0.8
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: Extends Ruby to support class interfaces
|