configem 1.0.1 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +35 -5
- data/lib/configem.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 951be63c4c472185405fc9b8f97ed8bae90153029549f4db7309fc9b004b5d63
|
4
|
+
data.tar.gz: cb38c9cada27277f697e846c0cebc1bc6b2e0c07dc7ce09d65c0570f19562d96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d01792a831239547eec1bbd134a07ae8e3574f7e3186dee194a397b5c13b290a46725d86ed36d38f633c684d08f327e9fc41d2bd5fd27e507d8bd6acada4922
|
7
|
+
data.tar.gz: 7a19c00a8190b1461cde8e91969de64c06b44d792a758f0801774e876af5200f339f93b71e99d0d83c181e3d608de973d6f4625324cd127076718d55f4599f12
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Configem
|
2
2
|
|
3
|
+
[![Ruby](https://github.com/alekpopovic/configem/actions/workflows/ruby.yml/badge.svg)](https://github.com/alekpopovic/configem/actions/workflows/ruby.yml)
|
4
|
+
|
3
5
|
A simple mixin to add configuration functionality to your classes
|
4
6
|
|
5
7
|
## Installation
|
@@ -8,22 +10,50 @@ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with
|
|
8
10
|
|
9
11
|
Install the gem and add to the application's Gemfile by executing:
|
10
12
|
|
11
|
-
$ bundle add
|
13
|
+
$ bundle add configem
|
12
14
|
|
13
15
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
16
|
|
15
|
-
$ gem install
|
17
|
+
$ gem install configem
|
16
18
|
|
17
19
|
## Usage
|
18
20
|
|
19
|
-
|
21
|
+
```sh
|
22
|
+
class Example1
|
23
|
+
include Configem
|
24
|
+
end
|
25
|
+
|
26
|
+
class Example2
|
27
|
+
extend Configem
|
28
|
+
end
|
29
|
+
|
30
|
+
class Example3
|
31
|
+
prepend Configem
|
32
|
+
end
|
33
|
+
|
34
|
+
Example1.configure do |config|
|
35
|
+
config.api_key_1 = "api_key_1_value"
|
36
|
+
end
|
37
|
+
|
38
|
+
Example2.configure do |config|
|
39
|
+
config.api_key_2 = "api_key_2_value"
|
40
|
+
end
|
41
|
+
|
42
|
+
Example3.configure do |config|
|
43
|
+
config.api_key_3 = "api_key_3_value"
|
44
|
+
end
|
45
|
+
|
46
|
+
puts Example1.config.api_key_1
|
47
|
+
|
48
|
+
puts Example2.config.api_key_2
|
49
|
+
|
50
|
+
puts Example3.config.api_key_3
|
51
|
+
```
|
20
52
|
|
21
53
|
## Development
|
22
54
|
|
23
55
|
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.
|
24
56
|
|
25
|
-
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).
|
26
|
-
|
27
57
|
## Contributing
|
28
58
|
|
29
59
|
Bug reports and pull requests are welcome on GitHub at https://github.com/alekpopovic/configem/issues. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/alekpopovic/configem/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/configem.rb
CHANGED