gemer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +7 -7
- data/lib/gemer.rb +0 -11
- data/lib/gemer/configurator.rb +12 -1
- data/lib/gemer/version.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: a524016eb3edaffbd382faf69354ecd10e21c06f16efccf35ca0296b8f5fbdd3
|
4
|
+
data.tar.gz: 60a9aedd6b40f2107eca85282538839f969dc27d13a6d28408ce1dd9cb3a8601
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2b9666ebf32cdf34c9d20748325a400b8fc3ac9f39605a3998c3bb3bc2938859cf87dd0c363d0a5b8ae5cf1610471e2316b95e950c3b01329a6414e7c3460e8
|
7
|
+
data.tar.gz: 6c6b1d348bed006f465a772168ff3e978ac9bdbee1392e964c613cb1713c6eb1877f89a5be2ed21e9168df99e59e282e2e5f6d7024ac449d3d4653a19ed0786b
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Gemer
|
2
2
|
|
3
3
|
A lightweight gem designed to provide tools for Ruby modules and gems
|
4
4
|
|
@@ -7,7 +7,7 @@ A lightweight gem designed to provide tools for Ruby modules and gems
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem '
|
10
|
+
gem 'gemer'
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -16,17 +16,17 @@ And then execute:
|
|
16
16
|
|
17
17
|
Or install it yourself as:
|
18
18
|
|
19
|
-
$ gem install
|
19
|
+
$ gem install gemer
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
23
|
### Configuration
|
24
24
|
|
25
|
-
Any module can be made configurable with
|
25
|
+
Any module can be made configurable with gemer with simple module extension:
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
module MyModule
|
29
|
-
include
|
29
|
+
include Gemer::Configurable
|
30
30
|
|
31
31
|
# Default configuration values
|
32
32
|
configure_defaults do |c|
|
@@ -61,7 +61,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
61
61
|
|
62
62
|
## Contributing
|
63
63
|
|
64
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/thebadmonkeydev/
|
64
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/thebadmonkeydev/gemer. 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.
|
65
65
|
|
66
66
|
## License
|
67
67
|
|
@@ -69,4 +69,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
69
69
|
|
70
70
|
## Code of Conduct
|
71
71
|
|
72
|
-
Everyone interacting in the
|
72
|
+
Everyone interacting in the gemer project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/thebadmonkeydev/gemer/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/gemer.rb
CHANGED
@@ -4,15 +4,4 @@ require 'gemer/configurator'
|
|
4
4
|
require 'pry'
|
5
5
|
|
6
6
|
module Gemer
|
7
|
-
include Gemer::Configurable
|
8
|
-
|
9
|
-
setup_config do |c|
|
10
|
-
c.attr :cache
|
11
|
-
c.attr :expiry, 5400
|
12
|
-
c.attr :force, false, in: [true, false]
|
13
|
-
c.attr :logger
|
14
|
-
c.attr :prefix
|
15
|
-
|
16
|
-
c.read_only :namespace, 'GraphQL::Cache'
|
17
|
-
end
|
18
7
|
end
|
data/lib/gemer/configurator.rb
CHANGED
@@ -43,12 +43,23 @@ module Gemer
|
|
43
43
|
@target.class_eval <<-DEF, __FILE__, __LINE__ + 1
|
44
44
|
class << self
|
45
45
|
def #{name}
|
46
|
-
@#{name} ||= #{value
|
46
|
+
@#{name} ||= #{interpolated_value(value)}
|
47
47
|
end
|
48
48
|
end
|
49
49
|
DEF
|
50
50
|
end
|
51
51
|
|
52
|
+
def interpolated_value(value)
|
53
|
+
case value.class.name
|
54
|
+
when 'NilClass'
|
55
|
+
'nil'
|
56
|
+
when 'String'
|
57
|
+
"'#{value}'"
|
58
|
+
else
|
59
|
+
value
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
52
63
|
def define_reader(name)
|
53
64
|
@target.class_eval <<-DEF, __FILE__, __LINE__ + 1
|
54
65
|
class << self
|
data/lib/gemer/version.rb
CHANGED