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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34188e6b30e63aa8bebb2dbeccbf6e4cf6052632
4
- data.tar.gz: b0a6eaebda73c3a36aadc35e1b7be0c9e5cd9de3
3
+ metadata.gz: b35d92ec31a7122dd1ae13949cceef741fbf338a
4
+ data.tar.gz: 207f03d7041d2f356701ed17b11bf8405e07bfe4
5
5
  SHA512:
6
- metadata.gz: 7632c3c2629e16775949260c2a433697ec846427b713427d670fa0ede735d83298a31c26dee58fdc51692f4c80a1fca7a94a4ebe144701d3b457a66927fc0729
7
- data.tar.gz: c5d5c560aff03c88f6d51dbf5c432bb03930e1601e692ec88331d2ffff97bb8215c0d51318298fd4a955029bf8afad4c267951678171095468e49f6fe8b98624
6
+ metadata.gz: 40748ace7a1a55a0328369e28b534a36c0feecec27c208340c41e019ba15a35fb5ba55efc7d806506c956e4c6edd95e74c8bd8951dedb51418077bbcc6ac4825
7
+ data.tar.gz: d2d5eb380260d1f30f8bcba6d8650d45b29ed8b3a5b44c05aeaa8475ed15da70ab9ea3443a5d967296485322352982b8ff75b91e5c9b1c2fb2057d5eb46b0e9b
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - "2.0"
5
+ - "2.1"
6
+ - "2.2"
7
+
8
+ before_install: gem install bundler
9
+
10
+ script: bundle exec rspec
11
+
12
+ git:
13
+ submodules: false
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in cdt-utilities.gemspec
4
4
  gemspec
5
+
6
+ gem 'rspec', require: false
7
+ gem 'simplecov', require: false
8
+ gem 'coveralls', require: false
data/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Some Ruby utilities.
4
4
 
5
+ ## Status
6
+
7
+ [![Gem Version](https://badge.fury.io/rb/cdt-utilities.svg)](https://badge.fury.io/rb/cdt-utilities)
8
+ [![Build Status](https://travis-ci.org/cabeza-de-termo/ruby-utilities.svg?branch=master)](https://travis-ci.org/cabeza-de-termo/ruby-utilities)
9
+ [![Coverage Status](https://coveralls.io/repos/cabeza-de-termo/ruby-utilities/badge.svg?branch=master&service=github)](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, arg_1, arg_2| puts string }, to: 'hello!')
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
@@ -22,6 +22,4 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.8"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "rspec"
26
- spec.add_development_dependency "simplecov"
27
25
  end
@@ -0,0 +1,7 @@
1
+ module CdT
2
+ class SubclassResponsibilityError < RuntimeError
3
+ def initialize()
4
+ super('Subclass responsibility')
5
+ end
6
+ end
7
+ end
data/lib/cdt/utilities.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  require_relative 'utilities/version'
2
- require_relative 'utilities/bind'
2
+ require_relative 'utilities/bind'
3
+ require_relative 'utilities/subclass-responsibility'
@@ -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
@@ -1,3 +1,3 @@
1
1
  module CdT
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  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.1.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-14 00:00:00.000000000 Z
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: