abstract_method_error 0.1.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 +7 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/Gemfile +10 -0
- data/README.md +40 -0
- data/Rakefile +8 -0
- data/abstract_method_error.gemspec +42 -0
- data/lib/abstract_method_error/version.rb +5 -0
- data/lib/abstract_method_error.rb +9 -0
- data/sig/abstract_method.rbs +4 -0
- metadata +52 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3087c81151c3fbd74e86a765993ee1962bbbd47aaa45df19cf920908f7a8cbdd
|
4
|
+
data.tar.gz: ca986a22158dd45ae296779b95805d9ec4897d956198fe70c278ef0044c190ea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 22e589763a387798ca47173e69b40f221e9e383d8b04ec477bf70ea0f1954a1820369f3d8940a5e3e8f976199814c774e7f896e2f50bafda964230b6149acee2
|
7
|
+
data.tar.gz: 5faefea03ea12147056e4ebaea2744d7478e1aa62c928e1dfe54104c59ac02bf9404cb3e4e15d0f8013577b6ba738550452f71ec851f58bf3c1722d68515095b
|
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-3.1.2
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# AbstractMethod
|
2
|
+
|
3
|
+
[Abstract
|
4
|
+
methods](https://en.wikipedia.org/wiki/Method_(computer_programming)#Abstract_methods)
|
5
|
+
are methods in base classes that lack an implementation but are supposed to be
|
6
|
+
defined in sub classes. It is an error if an abstract method is ever called
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
AbstractMethod monkey-patches Kernel to add the method `abstract_method` that
|
11
|
+
raise an AbstractMethodError exception when called. It is intendend to be used
|
12
|
+
in one-line declarations of abstract methods:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
require 'abstract_method'
|
16
|
+
|
17
|
+
class A
|
18
|
+
def method_to_be_defined_later = abstract_method
|
19
|
+
end
|
20
|
+
```
|
21
|
+
|
22
|
+
## Installation
|
23
|
+
|
24
|
+
Install the gem and add to the application's Gemfile by executing:
|
25
|
+
|
26
|
+
$ bundle add abstract_method
|
27
|
+
|
28
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
29
|
+
|
30
|
+
$ gem install abstract_method
|
31
|
+
|
32
|
+
## Development
|
33
|
+
|
34
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
35
|
+
|
36
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/abstract_method.
|
data/Rakefile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/abstract_method_error/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "abstract_method_error"
|
7
|
+
spec.version = AbstractMethodError::VERSION
|
8
|
+
spec.authors = ["Claus Rasmussen"]
|
9
|
+
spec.email = ["claus.l.rasmussen@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Provides Kernel#abstract_method"
|
12
|
+
spec.description = "Lets you define abstract methods that raise when called"
|
13
|
+
spec.homepage = "https://github.com/clrgit/abstract_method_error"
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(__dir__) do
|
20
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
21
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
22
|
+
end
|
23
|
+
end
|
24
|
+
spec.bindir = "exe"
|
25
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ["lib"]
|
27
|
+
|
28
|
+
# Uncomment to register a new dependency of your gem
|
29
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
30
|
+
|
31
|
+
# For more information and examples about making a new gem, check out our
|
32
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
33
|
+
|
34
|
+
# Add your production dependencies here
|
35
|
+
# spec.add_dependency GEM [, VERSION]
|
36
|
+
|
37
|
+
# Add your development dependencies here
|
38
|
+
# spec.add_development_dependency GEM [, VERSION]
|
39
|
+
|
40
|
+
# Also un-comment in spec/spec_helper to use simplecov
|
41
|
+
# spec.add_development_dependency "simplecov"
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: abstract_method_error
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Claus Rasmussen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Lets you define abstract methods that raise when called
|
14
|
+
email:
|
15
|
+
- claus.l.rasmussen@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".rspec"
|
21
|
+
- ".ruby-version"
|
22
|
+
- Gemfile
|
23
|
+
- README.md
|
24
|
+
- Rakefile
|
25
|
+
- abstract_method_error.gemspec
|
26
|
+
- lib/abstract_method_error.rb
|
27
|
+
- lib/abstract_method_error/version.rb
|
28
|
+
- sig/abstract_method.rbs
|
29
|
+
homepage: https://github.com/clrgit/abstract_method_error
|
30
|
+
licenses: []
|
31
|
+
metadata:
|
32
|
+
homepage_uri: https://github.com/clrgit/abstract_method_error
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubygems_version: 3.3.18
|
49
|
+
signing_key:
|
50
|
+
specification_version: 4
|
51
|
+
summary: Provides Kernel#abstract_method
|
52
|
+
test_files: []
|