sinderella 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -5
- data/lib/sinderella.rb +1 -1
- data/lib/sinderella/version.rb +1 -1
- data/spec/sinderella_spec.rb +1 -0
- 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: 39abb1c105e591f8898213b99b255d6a89f24954
|
4
|
+
data.tar.gz: 26d03bef0214e7800a626e470e04e715e2a41f20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac8a4eeef9c743682f312735bae50016345d776bb19f3c019290e67aca39088c724ed5a49055d2aeb9fabe0a98e5c41bf5b00688df38753a7753377ae48cb33c
|
7
|
+
data.tar.gz: 40048e55198f175968c588bcd817306d095688dd34e1dcfd0a6e65a30e86a99664fbcac1b0e0b3308af9c01d1ce700eed5480fdd69f4c2307aa0d4dd3435c4e5
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Sinderella
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/Integralist/Sinderella.png?branch=master)](https://travis-ci.org/Integralist/Sinderella)
|
3
|
+
[![Build Status](https://travis-ci.org/Integralist/Sinderella.png?branch=master)](https://travis-ci.org/Integralist/Sinderella) [![Gem Version](https://badge.fury.io/rb/sinderella.png)](http://badge.fury.io/rb/sinderella)
|
4
4
|
|
5
5
|
Ruby gem which will allow authors to pass a code block to transform a data object for a specific period of time.
|
6
6
|
|
@@ -27,16 +27,32 @@ Or install it yourself as:
|
|
27
27
|
## Usage
|
28
28
|
|
29
29
|
```ruby
|
30
|
+
require 'sinderella'
|
31
|
+
|
30
32
|
data = { :key => 'value' }
|
31
|
-
till_midnight = 60
|
33
|
+
till_midnight = 60 # 1 minute
|
32
34
|
|
33
35
|
id = Sinderella.transforms(data, till_midnight) do |data|
|
34
36
|
data.each do |key, value|
|
35
|
-
data.tap { |d| d[key].upcase! }
|
37
|
+
data.tap { |d| d[key].upcase! }
|
36
38
|
end
|
37
|
-
end
|
39
|
+
end
|
40
|
+
|
41
|
+
puts Sinderella.get(id)
|
42
|
+
|
43
|
+
# we'll randomly reset the data before the time expires...
|
44
|
+
puts "Resetting data early" and Sinderella.midnight(id) if (rand() * 2).to_i == 1
|
45
|
+
|
46
|
+
sleep 10
|
47
|
+
|
48
|
+
# if reset early == { :key => 'value' }
|
49
|
+
# if not reset early == { :key => 'VALUE' }
|
50
|
+
puts Sinderella.get(id)
|
51
|
+
|
52
|
+
sleep 60
|
38
53
|
|
39
|
-
|
54
|
+
# time has expired by this point so == { :key => 'value' }
|
55
|
+
puts Sinderella.get(id)
|
40
56
|
```
|
41
57
|
|
42
58
|
## Contributing
|
data/lib/sinderella.rb
CHANGED
data/lib/sinderella/version.rb
CHANGED
data/spec/sinderella_spec.rb
CHANGED