cdt-utilities 0.1.0 → 0.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.
- checksums.yaml +4 -4
- data/.travis.yml +13 -0
- data/Gemfile +4 -0
- data/README.md +26 -1
- data/cdt-utilities.gemspec +0 -2
- data/lib/cdt/errors/subclass-responsibility-error.rb +7 -0
- data/lib/cdt/utilities.rb +2 -1
- data/lib/cdt/utilities/subclass-responsibility.rb +18 -0
- data/lib/cdt/utilities/version.rb +1 -1
- metadata +5 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b35d92ec31a7122dd1ae13949cceef741fbf338a
|
4
|
+
data.tar.gz: 207f03d7041d2f356701ed17b11bf8405e07bfe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40748ace7a1a55a0328369e28b534a36c0feecec27c208340c41e019ba15a35fb5ba55efc7d806506c956e4c6edd95e74c8bd8951dedb51418077bbcc6ac4825
|
7
|
+
data.tar.gz: d2d5eb380260d1f30f8bcba6d8650d45b29ed8b3a5b44c05aeaa8475ed15da70ab9ea3443a5d967296485322352982b8ff75b91e5c9b1c2fb2057d5eb46b0e9b
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
Some Ruby utilities.
|
4
4
|
|
5
|
+
## Status
|
6
|
+
|
7
|
+
[](https://badge.fury.io/rb/cdt-utilities)
|
8
|
+
[](https://travis-ci.org/cabeza-de-termo/ruby-utilities)
|
9
|
+
[](https://coveralls.io/github/cabeza-de-termo/ruby-utilities?branch=master)
|
10
|
+
|
5
11
|
## Installation
|
6
12
|
|
7
13
|
Add this line to your application's Gemfile:
|
@@ -40,11 +46,30 @@ require 'cdt/utilities/bind'
|
|
40
46
|
CdT.bind_evaluation_of proc { puts self }, to: 'hello!'
|
41
47
|
|
42
48
|
# binding to self is not changed
|
43
|
-
CdT.bind_evaluation_of proc { |string
|
49
|
+
CdT.bind_evaluation_of proc { |string| puts string }, to: 'hello!')
|
44
50
|
|
45
51
|
CdT.bind_evaluation_of proc { |string, arg_1, arg_2| puts string + arg_1 + arg_2}, to: 'hello', with_args: [' world', '!'])
|
46
52
|
```
|
47
53
|
|
54
|
+
### CdT.subclass_responsibility
|
55
|
+
|
56
|
+
Utility to declare the implementation of a method to be the responsibility of a
|
57
|
+
subclass, and raise an error when the subclass did not implement it.
|
58
|
+
|
59
|
+
Example:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
require 'cdt/utilities'
|
63
|
+
# or if you just want this utility
|
64
|
+
require 'cdt/utilities/subclass-responsibility'
|
65
|
+
|
66
|
+
class SomeClass
|
67
|
+
def do_somehting()
|
68
|
+
CdT.subclass_responsibility
|
69
|
+
end
|
70
|
+
end
|
71
|
+
```
|
72
|
+
|
48
73
|
## Running the tests
|
49
74
|
|
50
75
|
```bash
|
data/cdt-utilities.gemspec
CHANGED
data/lib/cdt/utilities.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'cdt/errors/subclass-responsibility-error'
|
2
|
+
|
3
|
+
module CdT
|
4
|
+
#
|
5
|
+
# Utility to declare a method to be a responsibility of a subclass, and raise an
|
6
|
+
# error when the subclass did not implement it.
|
7
|
+
#
|
8
|
+
# Example:
|
9
|
+
# class SomeClass
|
10
|
+
# def do_somehting()
|
11
|
+
# CdT.subclass_responsibility
|
12
|
+
# end
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
def self.subclass_responsibility()
|
16
|
+
raise SubclassResponsibilityError.new
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cdt-utilities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Rubi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,34 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: simplecov
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
41
|
description:
|
70
42
|
email:
|
71
43
|
- martinrubi@gmail.com
|
@@ -75,13 +47,16 @@ extra_rdoc_files: []
|
|
75
47
|
files:
|
76
48
|
- ".gitignore"
|
77
49
|
- ".rspec"
|
50
|
+
- ".travis.yml"
|
78
51
|
- Gemfile
|
79
52
|
- LICENSE.txt
|
80
53
|
- README.md
|
81
54
|
- Rakefile
|
82
55
|
- cdt-utilities.gemspec
|
56
|
+
- lib/cdt/errors/subclass-responsibility-error.rb
|
83
57
|
- lib/cdt/utilities.rb
|
84
58
|
- lib/cdt/utilities/bind.rb
|
59
|
+
- lib/cdt/utilities/subclass-responsibility.rb
|
85
60
|
- lib/cdt/utilities/version.rb
|
86
61
|
homepage: https://github.com/cabeza-de-termo/ruby-utilities
|
87
62
|
licenses:
|