settingson 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/models/concerns/settingson/base.rb +2 -2
- data/lib/settingson/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d855dba93399013f3232112fb5c387ec630a2d2
|
4
|
+
data.tar.gz: 7f82756e384c88d1da5c9e94447f675196edd1ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd0c3532cd6169d0e581b9e7bcf9d7d71802f6e4ee63d2dc4704fa13f4665c84f64625eea004b1e87959ff9c39c60655dae49f63a7b1dc2912be7ce209e866d1
|
7
|
+
data.tar.gz: 547abb27ae4c7000997ec3d682a6f3e280aaf8f2151500d850ecea675c4b78cad0faaa7e2871b1985666a8ff106a4caaf75caf7495de31bb603c0617be61e75b
|
data/README.md
CHANGED
@@ -67,6 +67,14 @@ Settings.cached(30.minutes).hello.world # => 'message'
|
|
67
67
|
Settings.cached(1800).hello.world # => 'message'
|
68
68
|
```
|
69
69
|
|
70
|
+
Benchmark results:
|
71
|
+
```ruby
|
72
|
+
puts Benchmark.measure { 1.upto(10000){ Settings.hello.world }}
|
73
|
+
# => 36.210000 0.680000 36.890000 ( 37.372218)
|
74
|
+
puts Benchmark.measure { 1.upto(10000){ Settings.cached.hello.world }}
|
75
|
+
# => 7.140000 0.060000 7.200000 ( 7.246746)
|
76
|
+
```
|
77
|
+
|
70
78
|
### Using with [Simple Form](https://github.com/plataformatec/simple_form) and [Haml](https://github.com/haml/haml)
|
71
79
|
in view:
|
72
80
|
```ruby
|
@@ -29,7 +29,7 @@ module Settingson::Base
|
|
29
29
|
self.class.find_by(key: @settingson)
|
30
30
|
end
|
31
31
|
|
32
|
-
def _settingson_cached(expires_in
|
32
|
+
def _settingson_cached(expires_in)
|
33
33
|
@_settingson_cached = expires_in
|
34
34
|
self
|
35
35
|
end
|
@@ -158,7 +158,7 @@ module Settingson::Base
|
|
158
158
|
end
|
159
159
|
|
160
160
|
def cached(expires_in = 10.seconds)
|
161
|
-
new._settingson_cached(expires_in
|
161
|
+
new._settingson_cached(expires_in)
|
162
162
|
end
|
163
163
|
|
164
164
|
end # module ClassMethods
|
data/lib/settingson/version.rb
CHANGED