fatboy 0.0.1 → 0.0.4
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 +4 -4
- data/README.md +21 -5
- data/assets/logo-optimize.svg +27 -0
- data/assets/logo.svg +104 -0
- data/fatboy.gemspec +6 -7
- data/lib/fatboy.rb +24 -6
- data/lib/fatboy/helpers.rb +1 -1
- data/lib/fatboy/many.rb +52 -0
- data/lib/fatboy/popularity.rb +3 -3
- data/lib/fatboy/time_based_popularity.rb +2 -2
- data/lib/fatboy/version.rb +1 -1
- data/lib/fatboy/view_tracker.rb +65 -0
- data/spec/view_tracker_spec.rb +16 -0
- metadata +54 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fdf9075c10340ef250bf5ec9794bd1f8ad25e58
|
4
|
+
data.tar.gz: 31c8804ebf35bc9bb01d34d38995fbf6a90fee5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e354fbe959b821ab70f697ceb0aeb93ef52019ec71fbdbc1ae4adea36a0e020661b7acc6698946732c99957f97afa3a29a7de7bda47dd74ec6d24a0f4ac5de5f
|
7
|
+
data.tar.gz: bd14ec3051a3ebe391ab5364ec5f9439c39fd5b8c2e1e1307ad23cc5ed0dfe3f621da67252c9527d129980c949dcdebdac3cb9da684913e2aab311862cc9f8aa
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
|
1
|
+

|
2
|
+
|
2
3
|
##### See views, right here, right now
|
4
|
+
|
3
5
|
Fatboy is a gem which manages view counts on ActiveRecord objects (or things that quack like them).
|
6
|
+
|
4
7
|
It's great for seeing the most (and least) viewed models on your website.
|
5
8
|
To make things even better, Fatboy will store view counts by day, month, year,
|
6
9
|
and all-time.
|
@@ -29,7 +32,7 @@ Or install it yourself as:
|
|
29
32
|
Fatboy is easy to set up. First, initialize it:
|
30
33
|
|
31
34
|
```ruby
|
32
|
-
# if you don't provide your own redis,
|
35
|
+
# if you don't provide your own redis, fatboy will create one
|
33
36
|
# with Redis.new
|
34
37
|
fatboy = Fatboy.new(redis: redis)
|
35
38
|
```
|
@@ -48,7 +51,8 @@ Now, managing views is pretty useless if you can't retrieve them later.
|
|
48
51
|
Thankfully, fatboy makes this easy as well:
|
49
52
|
|
50
53
|
```ruby
|
51
|
-
fatboy.views_for(image) # => 1
|
54
|
+
fatboy.views_for(image).today # => 1
|
55
|
+
fatboy.views_for(image).this_year # => 1
|
52
56
|
```
|
53
57
|
|
54
58
|
Don't worry if that's a brand-new Fatboy instance---as long as the Redis is the same, Fatboy's view count will be the same.
|
@@ -59,7 +63,6 @@ Fatboy makes it easy to retrieve a list of the most-popular records in your data
|
|
59
63
|
Check it now now:
|
60
64
|
```ruby
|
61
65
|
fatboy.popular(Image).today.most # => most viewed image today
|
62
|
-
fatboy.popular("Image").all_time.most # => Top viewed image of all time
|
63
66
|
```
|
64
67
|
|
65
68
|
Want it from other days?
|
@@ -87,9 +90,22 @@ Or perhaps a range?
|
|
87
90
|
```
|
88
91
|
|
89
92
|
Fatboy makes it easier. See the rdoc for details.
|
93
|
+
##### Pipelined
|
94
|
+
|
95
|
+
If you need to view lots of models at once, you may find Fatboy::Many to be a good option.
|
96
|
+
Check it out now:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
m = fatboy.many
|
100
|
+
m[image]
|
101
|
+
comments.each{|c| m[c]}
|
102
|
+
m[description]
|
103
|
+
m.commit!
|
104
|
+
```
|
105
|
+
|
90
106
|
## Contributing
|
91
107
|
|
92
|
-
1. Fork it ( https://github.com/
|
108
|
+
1. Fork it ( https://github.com/AnthonySuper/fatboy/fork )
|
93
109
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
94
110
|
3. Write functionality and tests
|
95
111
|
4. Commit your changes (`git commit -am 'Add some feature'`)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
3
|
+
<svg id="svg2" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="351.21" width="327.79" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
4
|
+
<metadata id="metadata7">
|
5
|
+
<rdf:RDF>
|
6
|
+
<cc:Work rdf:about="">
|
7
|
+
<dc:format>image/svg+xml</dc:format>
|
8
|
+
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
9
|
+
<dc:title/>
|
10
|
+
</cc:Work>
|
11
|
+
</rdf:RDF>
|
12
|
+
</metadata>
|
13
|
+
<g id="layer1" transform="translate(-110.80005,-304.65093)">
|
14
|
+
<g id="g2990">
|
15
|
+
<path id="path2998" stroke-linejoin="miter" d="m388.15,443.75s-2.5254,1.0102-3.283,4.0406c-0.75761,3.0305-9.3439,16.162-9.3439,16.162s-7.0711,8.5863-3.5355,13.89c0,0,14.9,16.162,15.657,18.94,0.75761,2.7779,42.174,32.072,42.174,32.072s8.0812,7.0711,7.5761,10.102c-0.50507,3.0305,0.68891,17.191,0.68891,17.191l-3.7194,43.671-249-0.50507s4.5457-10.354,7.0711-11.617l0.25254-9.849s-4.2932-3.7881-10.102,0c-5.8084,3.7881-16.668,13.132-16.668,13.132s-3.0305,1.5152-4.5457-0.50508-9.3439-1.7678-9.3439-1.7678-6.0609-4.5457-6.566-7.0711c0,0-9.849-2.0203-16.415,0.75761,0,0-8.0812,1.2627-14.395-9.0914-6.3134-10.354-1.7678-40.406-1.7678-40.406s11.364-51.518,13.89-56.316c0,0,13.637-33.082,15.657-41.669,0,0,6.3874-19.902,8.8758-20.305,0,0,5.5189-7.4742-0.037-24.142,0,0-2.0203-5.0508-1.2627-8.8388,0.75762-3.7881,1.7678-13.89-1.7678-18.688-3.5355-4.7982-8.8388-17.425-8.8388-17.425s-0.50507-2.0203-1.0102-5.0508c-0.50508-3.0305-3.283-13.637-3.283-13.637s-1.0102-6.8185-2.7779-7.0711c-1.7678-0.25254,0-8.0812,4.5457-3.7881s6.8185,9.0914,6.8185,9.0914l2.0203,9.0914s1.7678,4.2932,3.0305-1.5152,2.2728-13.89,5.5558-17.678c3.283-3.7881,7.8287-9.0914,7.8287-9.0914s5.5558-2.5254,6.566,2.0203c0,0-2.2728,8.8388-5.3033,13.637-3.0304,4.7982-3.5355,14.395-3.5355,14.395s1.2627,2.5254,2.0203-0.75762c0.75761-3.283,7.0711-15.91,7.8287-16.162,0.75761-0.25253,4.7982-6.8185,7.3236-7.0711,2.5254-0.25254,6.0609-3.283,6.0609-3.283s6.3134-1.0102,5.5558,3.5355c-0.75762,4.5457-8.8388,12.627-8.8388,12.627l-5.0508,13.89s2.0203,1.5152,1.5152,6.0609c-0.50508,4.5457,0.75761,7.8287,0.75761,7.8287s1.2627,3.283,4.0406,0.25253c2.7779-3.0304,9.849-10.607,9.849-10.607s8.0812-4.7982,12.122-3.283c4.0406,1.5152,6.0609,2.7779,7.5762,4.5457,0,0,0.75761-2.2728,3.283-1.2627,2.5254,1.0102,3.5355,4.5457,3.5355,4.5457v6.3134s3.283,6.8185,3.283,8.0812-3.0305,10.102-5.0508,13.385c0,0-5.3033,11.617-9.849,16.92,0,0-9.3439,14.395-10.354,14.395-1.0102,0-9.3439,10.354-10.102,15.91,0,0-1.0102,7.8287-3.283,8.3338-2.2728,0.50508-10.354,23.991-11.112,43.689l-5.0508,43.184,5.3033-4.2932s0.75761-6.0609,9.5964-6.3134c0,0,3.283,1.0102,4.5457-2.0203s5.5558-5.0508,9.5964-4.7982c0,0,4.0406-6.566,10.102-6.0609,0,0,15.405-9.849,19.445-8.5863,0,0,5.8084-6.566,13.132-7.5761,0,0,13.89-15.405,17.93-16.92,4.0406-1.5152,5.5558-1.2627,8.3338-0.50508,2.7779,0.75762,11.869-1.7678,11.869-1.7678s5.8084,1.5152,8.3338,3.5355,9.0914,1.7678,9.0914,1.7678,0.25253-6.8185-2.0203-9.0914c-2.2728-2.2728-0.50507-36.618-0.50507-36.618l-1.5152-25.506s3.283-14.395,10.354-24.496c0,0,10.354-8.3338,10.102-10.354-0.25254-2.0203-4.7982-7.5761-6.566-8.5863s-0.75761-6.8185,8.5863-4.5457,16.415-2.2728,16.415-2.2728,11.112-3.5355,14.142-1.2627c3.0304,2.2728,7.3236,2.7779,10.859,2.5254,3.5355-0.25254,9.849-0.50508,11.869,3.5355,2.0203,4.0406,2.2728,5.5558,2.2728,5.5558s7.5761,2.5254,11.869,7.0711c4.2932,4.5457,18.183,22.476,18.183,22.476l-1.0102,37.123s5.3033,8.3338-7.8287,23.739" stroke="#000" stroke-linecap="butt" stroke-width="1px" fill="#000"/>
|
16
|
+
<path id="path3000" stroke-linejoin="miter" d="m206.07,351.57s-4.0406-0.25253-5.177,2.3991-8.46,9.9752-8.46,9.9752-4.672,4.9245-1.0102,6.4397,7.4499,1.6415,8.2075,0.63135c0.75761-1.0102,4.7982-10.733,6.1872-10.228,1.389,0.50507-1.389-7.5762,0.25254-9.2176z" stroke="#000" stroke-linecap="butt" stroke-width="1px" fill="#FFF"/>
|
17
|
+
<g id="flowRoot3002" style="letter-spacing:0px;word-spacing:0px;" font-weight="normal" transform="translate(12.214646,2.1428571)" font-size="40px" font-style="normal" font-family="Sans" line-height="125%" fill="#000">
|
18
|
+
<path id="path3021" style="text-align:center;" d="m228.73,615.93,20.293,0,0,5.6836-12.773,0,0,5.4297,12.012,0,0,5.6836-12.012,0,0,12.363-7.5195,0,0-29.16"/>
|
19
|
+
<path id="path3023" style="text-align:center;" d="m263.23,635.24c-1.4583,0.00001-2.5586,0.2474-3.3008,0.74218-0.72917,0.4948-1.0938,1.224-1.0938,2.1875-0.00001,0.88543,0.29296,1.582,0.87891,2.0898,0.59895,0.49479,1.4258,0.74219,2.4805,0.74219,1.3151,0,2.4219-0.46875,3.3203-1.4062,0.89842-0.95052,1.3476-2.1354,1.3476-3.5547v-0.80078h-3.6328m10.684-2.6367,0,12.48-7.0508,0,0-3.2422c-0.93751,1.3281-1.9922,2.2982-3.1641,2.9102-1.1719,0.59895-2.5977,0.89843-4.2773,0.89843-2.2656,0-4.1081-0.65755-5.5274-1.9726-1.4062-1.3281-2.1094-3.0469-2.1094-5.1562,0-2.5651,0.8789-4.4466,2.6367-5.6445,1.7708-1.1979,4.5443-1.7969,8.3203-1.7969h4.1211v-0.54687c-0.00001-1.1068-0.43621-1.914-1.3086-2.4219-0.87241-0.52082-2.2331-0.78123-4.082-0.78125-1.4974,0.00002-2.8906,0.14976-4.1797,0.44922-1.2891,0.2995-2.487,0.74871-3.5938,1.3477v-5.332c1.4974-0.36456,3.0013-0.63799,4.5117-0.82031,1.5104-0.19529,3.0208-0.29294,4.5312-0.29297,3.9453,0.00003,6.7904,0.78127,8.5352,2.3438,1.7578,1.5495,2.6367,4.0755,2.6367,7.5781"/>
|
20
|
+
<path id="path3025" style="text-align:center;" d="m288.09,617,0,6.2109,7.207,0,0,5-7.207,0,0,9.2773c-0.00001,1.0156,0.20182,1.7057,0.60547,2.0703,0.40364,0.35157,1.2044,0.52735,2.4024,0.52735h3.5938v5h-5.9961c-2.7604,0-4.7201-0.57292-5.8789-1.7188-1.1458-1.1588-1.7188-3.1185-1.7188-5.8789v-9.2773h-3.4766v-5h3.4766v-6.2109h6.9922"/>
|
21
|
+
<path id="path3027" style="text-align:center;" d="m311.23,640.58c1.4974,0,2.6367-0.54687,3.418-1.6406,0.79426-1.0937,1.1914-2.6823,1.1914-4.7656-0.00002-2.0833-0.39715-3.6719-1.1914-4.7656-0.78126-1.0937-1.9206-1.6406-3.418-1.6406-1.4974,0.00002-2.6498,0.5534-3.457,1.6602-0.79428,1.0938-1.1914,2.6758-1.1914,4.7461-0.00001,2.0703,0.39712,3.6589,1.1914,4.7656,0.80728,1.0938,1.9596,1.6406,3.457,1.6406m-4.6484-14.16c0.96353-1.276,2.0312-2.2135,3.2031-2.8125,1.1719-0.61196,2.5195-0.91794,4.043-0.91797,2.6953,0.00003,4.9088,1.0742,6.6406,3.2227,1.7317,2.1354,2.5976,4.8893,2.5976,8.2617-0.00002,3.3724-0.86591,6.1328-2.5976,8.2812-1.7318,2.1354-3.9453,3.2031-6.6406,3.2031-1.5234,0-2.8711-0.29948-4.043-0.89843-1.1719-0.61198-2.2396-1.556-3.2031-2.832v3.1641h-6.9922v-30.391h6.9922v11.719"/>
|
22
|
+
<path id="path3029" style="text-align:center;" d="m338.68,627.69c-1.5495,0.00002-2.7344,0.55992-3.5547,1.6797-0.8073,1.1068-1.2109,2.7084-1.2109,4.8047-0.00001,2.0964,0.40363,3.7044,1.2109,4.8242,0.82031,1.1068,2.0052,1.6602,3.5547,1.6602,1.5234,0.00001,2.6888-0.55338,3.4961-1.6602,0.80728-1.1198,1.2109-2.7279,1.2109-4.8242-0.00002-2.0963-0.40366-3.6979-1.2109-4.8047-0.8073-1.1198-1.9727-1.6797-3.4961-1.6797m0-5c3.763,0.00003,6.6992,1.0156,8.8086,3.0469,2.1224,2.0313,3.1836,4.8438,3.1836,8.4375-0.00003,3.5938-1.0612,6.4062-3.1836,8.4375-2.1094,2.0312-5.0456,3.0469-8.8086,3.0469-3.776,0-6.7318-1.0156-8.8672-3.0469-2.1224-2.0312-3.1836-4.8437-3.1836-8.4375,0-3.5937,1.0612-6.4062,3.1836-8.4375,2.1354-2.0312,5.0911-3.0468,8.8672-3.0469"/>
|
23
|
+
<path id="path3031" style="text-align:center;" d="m352.89,623.21,6.9922,0,5.8789,14.844,5-14.844,6.9922,0-9.1992,23.945c-0.92449,2.4349-2.0052,4.1341-3.2422,5.0977-1.224,0.97655-2.8451,1.4648-4.8633,1.4648h-4.043v-4.5898h2.1875c1.1849-0.00001,2.0443-0.18881,2.5781-0.56641,0.54687-0.37761,0.97004-1.0547,1.2695-2.0312l0.19531-0.60547-9.7461-22.715"/>
|
24
|
+
</g>
|
25
|
+
</g>
|
26
|
+
</g>
|
27
|
+
</svg>
|
data/assets/logo.svg
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
3
|
+
|
4
|
+
<svg
|
5
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
6
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
7
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
8
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
10
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
11
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
12
|
+
width="327.7937"
|
13
|
+
height="351.21347"
|
14
|
+
id="svg2"
|
15
|
+
version="1.1"
|
16
|
+
inkscape:version="0.48.4 r9939"
|
17
|
+
sodipodi:docname="logo-optimize.svg">
|
18
|
+
<defs
|
19
|
+
id="defs4" />
|
20
|
+
<sodipodi:namedview
|
21
|
+
id="base"
|
22
|
+
pagecolor="#ffffff"
|
23
|
+
bordercolor="#666666"
|
24
|
+
borderopacity="1.0"
|
25
|
+
inkscape:pageopacity="0.0"
|
26
|
+
inkscape:pageshadow="2"
|
27
|
+
inkscape:zoom="0.90509668"
|
28
|
+
inkscape:cx="198.53147"
|
29
|
+
inkscape:cy="183.37104"
|
30
|
+
inkscape:document-units="px"
|
31
|
+
inkscape:current-layer="layer1"
|
32
|
+
showgrid="false"
|
33
|
+
inkscape:window-width="1215"
|
34
|
+
inkscape:window-height="776"
|
35
|
+
inkscape:window-x="65"
|
36
|
+
inkscape:window-y="24"
|
37
|
+
inkscape:window-maximized="1"
|
38
|
+
width="3543.31px"
|
39
|
+
fit-margin-top="0"
|
40
|
+
fit-margin-left="0"
|
41
|
+
fit-margin-right="0"
|
42
|
+
fit-margin-bottom="0" />
|
43
|
+
<metadata
|
44
|
+
id="metadata7">
|
45
|
+
<rdf:RDF>
|
46
|
+
<cc:Work
|
47
|
+
rdf:about="">
|
48
|
+
<dc:format>image/svg+xml</dc:format>
|
49
|
+
<dc:type
|
50
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
51
|
+
<dc:title></dc:title>
|
52
|
+
</cc:Work>
|
53
|
+
</rdf:RDF>
|
54
|
+
</metadata>
|
55
|
+
<g
|
56
|
+
inkscape:label="Layer 1"
|
57
|
+
inkscape:groupmode="layer"
|
58
|
+
id="layer1"
|
59
|
+
transform="translate(-110.80005,-304.65093)">
|
60
|
+
<g
|
61
|
+
id="g2990">
|
62
|
+
<path
|
63
|
+
sodipodi:nodetypes="csccscscccccscscccscccccsscscssccssccscssscsccscscscsccsccscsccccsccccsscscscccssscssscsccc"
|
64
|
+
inkscape:connector-curvature="0"
|
65
|
+
id="path2998"
|
66
|
+
d="m 388.15112,443.74527 c 0,0 -2.52539,1.01016 -3.283,4.04061 -0.75761,3.03046 -9.34391,16.16244 -9.34391,16.16244 0,0 -7.07107,8.5863 -3.53553,13.8896 0,0 14.89975,16.16244 15.65736,18.94036 0.75761,2.77792 42.17387,32.07235 42.17387,32.07235 0,0 8.08122,7.07106 7.57614,10.10152 -0.50507,3.03046 0.68891,17.19054 0.68891,17.19054 l -3.71937,43.67115 -249.0026,-0.50507 c 0,0 4.54569,-10.35407 7.07107,-11.61676 l 0.25254,-9.84899 c 0,0 -4.29315,-3.78807 -10.10153,0 -5.80837,3.78808 -16.66751,13.13199 -16.66751,13.13199 0,0 -3.03046,1.51523 -4.54569,-0.50508 -1.51523,-2.0203 -9.34391,-1.76777 -9.34391,-1.76777 0,0 -6.06092,-4.54568 -6.56599,-7.07106 0,0 -9.84899,-2.02031 -16.41498,0.75761 0,0 -8.08122,1.26269 -14.39468,-9.09137 -6.31345,-10.35407 -1.76776,-40.4061 -1.76776,-40.4061 0,0 11.36421,-51.51778 13.88959,-56.31601 0,0 13.63706,-33.08249 15.65737,-41.66879 0,0 6.38742,-19.90193 8.87581,-20.30503 0,0 5.51886,-7.47417 -0.037,-24.14168 0,0 -2.0203,-5.05077 -1.26269,-8.83884 0.75762,-3.78807 1.76777,-13.8896 -1.76776,-18.68782 -3.53554,-4.79822 -8.83884,-17.42513 -8.83884,-17.42513 0,0 -0.50507,-2.02031 -1.01015,-5.05076 -0.50508,-3.03046 -3.283,-13.63706 -3.283,-13.63706 0,0 -1.01015,-6.81853 -2.77792,-7.07107 -1.76776,-0.25254 0,-8.08122 4.54569,-3.78807 4.54569,4.29314 6.81853,9.09137 6.81853,9.09137 l 2.0203,9.09137 c 0,0 1.76777,4.29315 3.03046,-1.51523 1.26269,-5.80837 2.27285,-13.88959 5.55584,-17.67767 3.283,-3.78807 7.82868,-9.09137 7.82868,-9.09137 0,0 5.55584,-2.52538 6.56599,2.02031 0,0 -2.27284,8.83883 -5.3033,13.63706 -3.03045,4.79822 -3.53553,14.39467 -3.53553,14.39467 0,0 1.26269,2.52538 2.02031,-0.75762 0.75761,-3.28299 7.07106,-15.9099 7.82868,-16.16244 0.75761,-0.25253 4.79822,-6.81853 7.3236,-7.07106 2.52539,-0.25254 6.06092,-3.283 6.06092,-3.283 0,0 6.31345,-1.01015 5.55584,3.53553 -0.75762,4.54569 -8.83884,12.62691 -8.83884,12.62691 l -5.05076,13.8896 c 0,0 2.02031,1.51523 1.51523,6.06091 -0.50508,4.54569 0.75761,7.82869 0.75761,7.82869 0,0 1.26269,3.28299 4.04061,0.25253 2.77792,-3.03045 9.84899,-10.6066 9.84899,-10.6066 0,0 8.08122,-4.79822 12.12183,-3.28299 4.04061,1.51523 6.06092,2.77792 7.57615,4.54568 0,0 0.75761,-2.27284 3.28299,-1.26269 2.52538,1.01016 3.53554,4.54569 3.53554,4.54569 l 0,6.31345 c 0,0 3.28299,6.81853 3.28299,8.08122 0,1.26269 -3.03046,10.10153 -5.05076,13.38452 0,0 -5.3033,11.61676 -9.84899,16.92006 0,0 -9.34391,14.39467 -10.35406,14.39467 -1.01015,0 -9.34391,10.35407 -10.10153,15.90991 0,0 -1.01015,7.82868 -3.28299,8.33375 -2.27285,0.50508 -10.35407,23.99113 -11.11168,43.6891 l -5.05076,43.18402 5.3033,-4.29315 c 0,0 0.75761,-6.06091 9.59645,-6.31345 0,0 3.28299,1.01015 4.54568,-2.0203 1.26269,-3.03046 5.55584,-5.05077 9.59645,-4.79823 0,0 4.04061,-6.56599 10.10153,-6.06091 0,0 15.40482,-9.84899 19.44543,-8.5863 0,0 5.80838,-6.56599 13.13199,-7.57614 0,0 13.88959,-15.40483 17.9302,-16.92006 4.04061,-1.51523 5.55584,-1.26269 8.33376,-0.50508 2.77792,0.75762 11.8693,-1.76776 11.8693,-1.76776 0,0 5.80837,1.51523 8.33375,3.53553 2.52539,2.02031 9.09138,1.76777 9.09138,1.76777 0,0 0.25253,-6.81853 -2.02031,-9.09137 -2.27284,-2.27285 -0.50507,-36.61803 -0.50507,-36.61803 l -1.51523,-25.50636 c 0,0 3.28299,-14.39467 10.35406,-24.4962 0,0 10.35406,-8.33375 10.10153,-10.35406 -0.25254,-2.0203 -4.79823,-7.57614 -6.566,-8.5863 -1.76776,-1.01015 -0.75761,-6.81853 8.5863,-4.54568 9.34391,2.27284 16.41498,-2.27285 16.41498,-2.27285 0,0 11.11168,-3.53553 14.14214,-1.26269 3.03045,2.27285 7.3236,2.77792 10.85913,2.52539 3.53554,-0.25254 9.84899,-0.50508 11.8693,3.53553 2.0203,4.04061 2.27284,5.55584 2.27284,5.55584 0,0 7.57614,2.52538 11.86929,7.07107 4.29315,4.54568 18.18275,22.47589 18.18275,22.47589 l -1.01015,37.12311 c 0,0 5.3033,8.33375 -7.82869,23.73858"
|
67
|
+
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
68
|
+
<path
|
69
|
+
inkscape:connector-curvature="0"
|
70
|
+
id="path3000"
|
71
|
+
d="m 206.07112,351.56885 c 0,0 -4.04061,-0.25253 -5.17703,2.39912 -1.13642,2.65165 -8.46003,9.97525 -8.46003,9.97525 0,0 -4.67196,4.9245 -1.01015,6.43972 3.6618,1.51523 7.44987,1.6415 8.20749,0.63135 0.75761,-1.01015 4.79822,-10.73287 6.18718,-10.22779 1.38896,0.50507 -1.38896,-7.57615 0.25254,-9.21765 z"
|
72
|
+
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
73
|
+
<g
|
74
|
+
transform="translate(12.214646,2.1428571)"
|
75
|
+
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
|
76
|
+
id="flowRoot3002">
|
77
|
+
<path
|
78
|
+
d="m 228.73437,615.92856 20.29297,0 0,5.68359 -12.77343,0 0,5.42969 12.01171,0 0,5.6836 -12.01171,0 0,12.36328 -7.51954,0 0,-29.16016"
|
79
|
+
style="font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;text-anchor:middle;font-family:OpenSymbol;-inkscape-font-specification:OpenSymbol Bold"
|
80
|
+
id="path3021" />
|
81
|
+
<path
|
82
|
+
d="m 263.22656,635.24497 c -1.45834,1e-5 -2.5586,0.2474 -3.30078,0.74218 -0.72917,0.4948 -1.09376,1.22397 -1.09375,2.1875 -10e-6,0.88543 0.29296,1.58204 0.87891,2.08985 0.59895,0.49479 1.42577,0.74219 2.48047,0.74219 1.31509,0 2.42186,-0.46875 3.32031,-1.40625 0.89842,-0.95052 1.34764,-2.13541 1.34765,-3.55469 l 0,-0.80078 -3.63281,0 m 10.6836,-2.63672 0,12.48047 -7.05079,0 0,-3.24219 c -0.93751,1.32813 -1.9922,2.29818 -3.16406,2.91016 -1.17188,0.59895 -2.59766,0.89843 -4.27734,0.89843 -2.26563,0 -4.10808,-0.65755 -5.52735,-1.97265 -1.40625,-1.32813 -2.10937,-3.04687 -2.10937,-5.15625 0,-2.5651 0.8789,-4.44661 2.63672,-5.64453 1.77083,-1.19791 4.54426,-1.79687 8.32031,-1.79688 l 4.12109,0 0,-0.54687 c -1e-5,-1.10676 -0.43621,-1.91405 -1.30859,-2.42188 -0.87241,-0.52082 -2.23308,-0.78123 -4.08203,-0.78125 -1.49741,2e-5 -2.89063,0.14976 -4.17969,0.44922 -1.28907,0.2995 -2.48698,0.74871 -3.59375,1.34766 l 0,-5.33204 c 1.49739,-0.36456 3.0013,-0.63799 4.51172,-0.82031 1.51041,-0.19529 3.02082,-0.29294 4.53125,-0.29297 3.9453,3e-5 6.79035,0.78127 8.53516,2.34375 1.75779,1.5495 2.63669,4.07554 2.63672,7.57813"
|
83
|
+
style="font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;text-anchor:middle;font-family:OpenSymbol;-inkscape-font-specification:OpenSymbol Bold"
|
84
|
+
id="path3023" />
|
85
|
+
<path
|
86
|
+
d="m 288.08984,617.00278 0,6.21094 7.20703,0 0,5 -7.20703,0 0,9.27734 c -10e-6,1.01563 0.20182,1.70574 0.60547,2.07031 0.40364,0.35157 1.20442,0.52735 2.40235,0.52735 l 3.59375,0 0,5 -5.9961,0 c -2.76042,0 -4.72006,-0.57292 -5.8789,-1.71875 -1.14584,-1.15885 -1.71876,-3.11849 -1.71875,-5.87891 l 0,-9.27734 -3.47657,0 0,-5 3.47657,0 0,-6.21094 6.99218,0"
|
87
|
+
style="font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;text-anchor:middle;font-family:OpenSymbol;-inkscape-font-specification:OpenSymbol Bold"
|
88
|
+
id="path3025" />
|
89
|
+
<path
|
90
|
+
d="m 311.23437,640.577 c 1.49738,0 2.63671,-0.54687 3.41797,-1.64063 0.79426,-1.09374 1.19139,-2.68228 1.19141,-4.76562 -2e-5,-2.08332 -0.39715,-3.67186 -1.19141,-4.76563 -0.78126,-1.09373 -1.92059,-1.6406 -3.41797,-1.64062 -1.4974,2e-5 -2.64975,0.5534 -3.45703,1.66015 -0.79428,1.09377 -1.19141,2.6758 -1.1914,4.7461 -10e-6,2.07032 0.39712,3.65886 1.1914,4.76562 0.80728,1.09376 1.95963,1.64063 3.45703,1.64063 m -4.64843,-14.16016 c 0.96353,-1.27602 2.03124,-2.21352 3.20312,-2.8125 1.17186,-0.61196 2.51952,-0.91794 4.04297,-0.91797 2.69529,3e-5 4.90883,1.07424 6.64063,3.22266 1.73174,2.13543 2.59763,4.88934 2.59765,8.26172 -2e-5,3.3724 -0.86591,6.13281 -2.59765,8.28125 -1.7318,2.13541 -3.94534,3.20312 -6.64063,3.20312 -1.52345,0 -2.87111,-0.29948 -4.04297,-0.89843 -1.17188,-0.61198 -2.23959,-1.55599 -3.20312,-2.83204 l 0,3.16407 -6.99219,0 0,-30.39063 6.99219,0 0,11.71875"
|
91
|
+
style="font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;text-anchor:middle;font-family:OpenSymbol;-inkscape-font-specification:OpenSymbol Bold"
|
92
|
+
id="path3027" />
|
93
|
+
<path
|
94
|
+
d="m 338.67578,627.68637 c -1.54949,2e-5 -2.73438,0.55992 -3.55469,1.67969 -0.8073,1.10679 -1.21094,2.70835 -1.21093,4.80469 -1e-5,2.09636 0.40363,3.70443 1.21093,4.82422 0.82031,1.10677 2.0052,1.66016 3.55469,1.66015 1.52342,10e-6 2.68879,-0.55338 3.49609,-1.66015 0.80728,-1.11979 1.21092,-2.72786 1.21094,-4.82422 -2e-5,-2.09634 -0.40366,-3.6979 -1.21094,-4.80469 -0.8073,-1.11977 -1.97267,-1.67967 -3.49609,-1.67969 m 0,-5 c 3.763,3e-5 6.6992,1.01565 8.80859,3.04688 2.12238,2.03127 3.18357,4.84376 3.1836,8.4375 -3e-5,3.59376 -1.06122,6.40625 -3.1836,8.4375 -2.10939,2.03125 -5.04559,3.04687 -8.80859,3.04687 -3.77605,0 -6.73178,-1.01562 -8.86719,-3.04687 -2.12239,-2.03125 -3.18359,-4.84374 -3.18359,-8.4375 0,-3.59374 1.0612,-6.40623 3.18359,-8.4375 2.13541,-2.03123 5.09114,-3.04685 8.86719,-3.04688"
|
95
|
+
style="font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;text-anchor:middle;font-family:OpenSymbol;-inkscape-font-specification:OpenSymbol Bold"
|
96
|
+
id="path3029" />
|
97
|
+
<path
|
98
|
+
d="m 352.89453,623.21372 6.99219,0 5.8789,14.84375 5,-14.84375 6.99219,0 -9.19922,23.94531 c -0.92449,2.43489 -2.00522,4.13411 -3.24218,5.09766 -1.22397,0.97655 -2.84507,1.46483 -4.86329,1.46484 l -4.04296,0 0,-4.58984 2.1875,0 c 1.18488,-1e-5 2.04426,-0.18881 2.57812,-0.56641 0.54687,-0.37761 0.97004,-1.05469 1.26953,-2.03125 l 0.19531,-0.60547 -9.74609,-22.71484"
|
99
|
+
style="font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;text-anchor:middle;font-family:OpenSymbol;-inkscape-font-specification:OpenSymbol Bold"
|
100
|
+
id="path3031" />
|
101
|
+
</g>
|
102
|
+
</g>
|
103
|
+
</g>
|
104
|
+
</svg>
|
data/fatboy.gemspec
CHANGED
@@ -22,13 +22,12 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler", "~> 1.6"
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.6", ">= 1.6"
|
26
26
|
spec.add_development_dependency "rake"
|
27
|
-
spec.add_development_dependency "rspec"
|
28
|
-
spec.add_development_dependency "timecop"
|
29
|
-
spec.add_development_dependency "mock_redis"
|
30
|
-
spec.add_development_dependency "simplecov"
|
31
|
-
spec.add_runtime_dependency "redis"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.2.0", ">= 3.2"
|
28
|
+
spec.add_development_dependency "timecop", "~> 0.7.3", ">= 0.7"
|
29
|
+
spec.add_development_dependency "mock_redis", "~> 0.14.0", ">= 0.14.0"
|
30
|
+
spec.add_development_dependency "simplecov", "~> 0.9.2", ">= 0.9.2"
|
31
|
+
spec.add_runtime_dependency "redis", "~> 3.2.1", ">= 3.2"
|
32
32
|
spec.required_ruby_version = ">= 2.0"
|
33
|
-
|
34
33
|
end
|
data/lib/fatboy.rb
CHANGED
@@ -2,9 +2,10 @@ require "fatboy/version"
|
|
2
2
|
require 'redis'
|
3
3
|
require_relative './fatboy/popularity'
|
4
4
|
require_relative './fatboy/helpers'
|
5
|
+
require_relative './fatboy/view_tracker'
|
5
6
|
##
|
6
7
|
# Fatboy is the main class for interacting with the system.
|
7
|
-
# It provides a variety of functionality.
|
8
|
+
# It provides a variety of functionality.
|
8
9
|
class Fatboy
|
9
10
|
##
|
10
11
|
# Create a new Fatboy.
|
@@ -14,6 +15,17 @@ class Fatboy
|
|
14
15
|
@redis = redis
|
15
16
|
end
|
16
17
|
##
|
18
|
+
# Many provides a way to view many different models at once, for
|
19
|
+
# speed reasons.
|
20
|
+
#
|
21
|
+
# Great if you need to view a lot of models.
|
22
|
+
def many
|
23
|
+
Fatboy::Many.new(@redis)
|
24
|
+
end
|
25
|
+
def views_for(model)
|
26
|
+
Fatboy::ViewTracker.new(@redis, model)
|
27
|
+
end
|
28
|
+
##
|
17
29
|
# Say that you have viewed an object, making the proper records for
|
18
30
|
# hour, day, month, and year.
|
19
31
|
# * +model+ - a model of some sort. Should quack like an ActiveRecord model (that is, responding to .id)
|
@@ -22,14 +34,20 @@ class Fatboy
|
|
22
34
|
stores = Fatboy::Helpers.all_format(Time.now).map do |time|
|
23
35
|
Fatboy::Helpers.format_store(obj.class.to_s, time)
|
24
36
|
end
|
25
|
-
|
37
|
+
@redis.pipelined do
|
38
|
+
stores.each do |store|
|
39
|
+
inc_member(store, obj.id)
|
40
|
+
end
|
41
|
+
end
|
26
42
|
end
|
27
43
|
##
|
28
44
|
# let users view with a shorthand
|
29
|
-
|
45
|
+
def [](obj)
|
46
|
+
view(obj)
|
47
|
+
end
|
30
48
|
##
|
31
|
-
# This method returns a Fatboy::Popularity, the main interface for
|
32
|
-
# determining the popularity of your models.
|
49
|
+
# This method returns a Fatboy::Popularity, the main interface for
|
50
|
+
# determining the popularity of your models.
|
33
51
|
# Example:
|
34
52
|
# fatboy.popular(Image)
|
35
53
|
# fatboy.popular("Image")
|
@@ -38,7 +56,7 @@ class Fatboy
|
|
38
56
|
Popularity.new(model, @redis)
|
39
57
|
end
|
40
58
|
##
|
41
|
-
# Format string we use to store the views per hour
|
59
|
+
# Format string we use to store the views per hour
|
42
60
|
HOUR_FORMAT_STR = "%Y%m%d%H"
|
43
61
|
##
|
44
62
|
# Format string we use to store the views per day
|
data/lib/fatboy/helpers.rb
CHANGED
@@ -33,7 +33,7 @@ class Fatboy
|
|
33
33
|
yr.utc.strftime(Fatboy::YEAR_FORMAT_STR)
|
34
34
|
end
|
35
35
|
##
|
36
|
-
# Get an array of the hour format, the day format, the month format, and
|
36
|
+
# Get an array of the hour format, the day format, the month format, and
|
37
37
|
# the year format
|
38
38
|
def self.all_format(time)
|
39
39
|
[:hour_format, :day_format, :month_format, :year_format].map do |func|
|
data/lib/fatboy/many.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
class Fatboy
|
2
|
+
##
|
3
|
+
# This class provides a way to pipeline many different views, adding
|
4
|
+
# efficiency.
|
5
|
+
# Usage:
|
6
|
+
#
|
7
|
+
# m = fatboy.many
|
8
|
+
# m[image]
|
9
|
+
# m[comment]
|
10
|
+
# m[comment2]
|
11
|
+
# m[description]
|
12
|
+
# m.commit!
|
13
|
+
class Many
|
14
|
+
##
|
15
|
+
# Don't initialize this yourself.
|
16
|
+
def initialize(redis)
|
17
|
+
@redis = redis
|
18
|
+
@models = []
|
19
|
+
end
|
20
|
+
##
|
21
|
+
# Alias for view
|
22
|
+
def [](o)
|
23
|
+
view o
|
24
|
+
end
|
25
|
+
def view(obj)
|
26
|
+
@models << obj
|
27
|
+
end
|
28
|
+
|
29
|
+
def commit!
|
30
|
+
stores = Fatboy::Helpers.all_format(Time.now)
|
31
|
+
@redis.pipelined do
|
32
|
+
@models.each do |model|
|
33
|
+
redis_view(model, stores)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
protected
|
38
|
+
##
|
39
|
+
# Basically copy/pasted from the Fatboy class.
|
40
|
+
# The second argument is so that we don't need to calculate the time
|
41
|
+
# string multiple times.
|
42
|
+
def redis_view(model, stores)
|
43
|
+
stores.each do |store|
|
44
|
+
inc_member(store, model.id)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def inc_member(store, id)
|
49
|
+
@redis.zincrby(store, 1, id)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/fatboy/popularity.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative './time_based_popularity'
|
2
2
|
class Fatboy
|
3
3
|
##
|
4
|
-
# This class is used to query how popular something is.
|
4
|
+
# This class is used to query how popular something is.
|
5
5
|
class Popularity
|
6
6
|
##
|
7
7
|
# We always pass in a redis
|
@@ -25,7 +25,7 @@ class Fatboy
|
|
25
25
|
def day(time)
|
26
26
|
fmt_time = Fatboy::Helpers.day_format(time.utc)
|
27
27
|
store_name = Fatboy::Helpers.format_store(@model_name, fmt_time)
|
28
|
-
|
28
|
+
|
29
29
|
Fatboy::TimeBasedPopularity.new(@redis, store_name)
|
30
30
|
end
|
31
31
|
##
|
@@ -62,7 +62,7 @@ class Fatboy
|
|
62
62
|
month(Time.now)
|
63
63
|
end
|
64
64
|
##
|
65
|
-
# Get a Fatboy::TimeBasedPopularity for this year.
|
65
|
+
# Get a Fatboy::TimeBasedPopularity for this year.
|
66
66
|
def this_year
|
67
67
|
year(Time.now)
|
68
68
|
end
|
@@ -12,7 +12,7 @@ class Fatboy
|
|
12
12
|
@store = store
|
13
13
|
end
|
14
14
|
##
|
15
|
-
# Get an enumerator of all viewed items, as a Fatboy::ViewedItem, in
|
15
|
+
# Get an enumerator of all viewed items, as a Fatboy::ViewedItem, in
|
16
16
|
# rank order.
|
17
17
|
# Pretty useful for lazy operations and such.
|
18
18
|
def enumerator
|
@@ -21,7 +21,7 @@ class Fatboy
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
##
|
24
|
-
# Get the most viewed item.
|
24
|
+
# Get the most viewed item.
|
25
25
|
# Returns a Fatboy::ViewedItem
|
26
26
|
def most
|
27
27
|
range(0..1).first
|
data/lib/fatboy/version.rb
CHANGED
@@ -0,0 +1,65 @@
|
|
1
|
+
require_relative './viewed_item'
|
2
|
+
require_relative './helpers'
|
3
|
+
class Fatboy
|
4
|
+
class ViewTracker
|
5
|
+
def initialize(redis, model)
|
6
|
+
@redis = redis
|
7
|
+
@model_name = model.class.to_s
|
8
|
+
@id = model.id
|
9
|
+
end
|
10
|
+
##
|
11
|
+
# How often this model was viewed this hour
|
12
|
+
def this_hour
|
13
|
+
hour(Time.now)
|
14
|
+
end
|
15
|
+
##
|
16
|
+
# How often this model was viewed today
|
17
|
+
def today
|
18
|
+
day(Time.now)
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# How often this model was viewed this month
|
23
|
+
def this_month
|
24
|
+
day(Time.now)
|
25
|
+
end
|
26
|
+
##
|
27
|
+
# How often this model was viewed this year
|
28
|
+
def this_year
|
29
|
+
year(Time.now)
|
30
|
+
end
|
31
|
+
##
|
32
|
+
# How often the model was viewed on a particular hour
|
33
|
+
def hour(time)
|
34
|
+
time = Fatboy::Helpers.hour_format(time.utc)
|
35
|
+
store = Fatboy::Helpers.format_store(@model_name, time)
|
36
|
+
@redis.zscore(store, @id)
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# How often the model was viewed in a particular day
|
41
|
+
def day(time)
|
42
|
+
time = Fatboy::Helpers.day_format(time.utc)
|
43
|
+
store = Fatboy::Helpers.format_store(@model_name, time)
|
44
|
+
get_score(store)
|
45
|
+
end
|
46
|
+
##
|
47
|
+
# How often the model was viewed in a particular month
|
48
|
+
def month(time)
|
49
|
+
time = Fatboy::Helpers.month_format(time.utc)
|
50
|
+
store = Fatboy::Helpers.format_store(@model_name, time)
|
51
|
+
get_score(store)
|
52
|
+
end
|
53
|
+
##
|
54
|
+
# How often teh model was viewed in a particular year
|
55
|
+
def year(time)
|
56
|
+
time = Fatboy::Helpers.month_format(time.utc)
|
57
|
+
store = Fatboy::Helpers.format_store(@model_name, time)
|
58
|
+
get_score(store)
|
59
|
+
end
|
60
|
+
protected
|
61
|
+
def get_score(store)
|
62
|
+
@redis.zscore(store, @id)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Fatboy::ViewTracker do
|
4
|
+
let(:redis){MockRedis.new}
|
5
|
+
let(:f){Fatboy.new redis: redis}
|
6
|
+
it "views based on time period" do
|
7
|
+
Timecop.travel(Date.today) do
|
8
|
+
m = Model.new(10)
|
9
|
+
f[m]
|
10
|
+
expect(f.views_for(m).this_hour).to eq(1)
|
11
|
+
expect(f.views_for(m).today).to eq(1)
|
12
|
+
expect(f.views_for(m).this_month).to eq(1)
|
13
|
+
expect(f.views_for(m).this_year).to eq(1)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fatboy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Super
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1.6'
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,6 +27,9 @@ dependencies:
|
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '1.6'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.6'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rake
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,72 +48,102 @@ dependencies:
|
|
42
48
|
name: rspec
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 3.2.0
|
45
54
|
- - ">="
|
46
55
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
56
|
+
version: '3.2'
|
48
57
|
type: :development
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 3.2.0
|
52
64
|
- - ">="
|
53
65
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
66
|
+
version: '3.2'
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
name: timecop
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
58
70
|
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 0.7.3
|
59
74
|
- - ">="
|
60
75
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
76
|
+
version: '0.7'
|
62
77
|
type: :development
|
63
78
|
prerelease: false
|
64
79
|
version_requirements: !ruby/object:Gem::Requirement
|
65
80
|
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.7.3
|
66
84
|
- - ">="
|
67
85
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
86
|
+
version: '0.7'
|
69
87
|
- !ruby/object:Gem::Dependency
|
70
88
|
name: mock_redis
|
71
89
|
requirement: !ruby/object:Gem::Requirement
|
72
90
|
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.14.0
|
73
94
|
- - ">="
|
74
95
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
96
|
+
version: 0.14.0
|
76
97
|
type: :development
|
77
98
|
prerelease: false
|
78
99
|
version_requirements: !ruby/object:Gem::Requirement
|
79
100
|
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.14.0
|
80
104
|
- - ">="
|
81
105
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
106
|
+
version: 0.14.0
|
83
107
|
- !ruby/object:Gem::Dependency
|
84
108
|
name: simplecov
|
85
109
|
requirement: !ruby/object:Gem::Requirement
|
86
110
|
requirements:
|
111
|
+
- - "~>"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 0.9.2
|
87
114
|
- - ">="
|
88
115
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
116
|
+
version: 0.9.2
|
90
117
|
type: :development
|
91
118
|
prerelease: false
|
92
119
|
version_requirements: !ruby/object:Gem::Requirement
|
93
120
|
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 0.9.2
|
94
124
|
- - ">="
|
95
125
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
126
|
+
version: 0.9.2
|
97
127
|
- !ruby/object:Gem::Dependency
|
98
128
|
name: redis
|
99
129
|
requirement: !ruby/object:Gem::Requirement
|
100
130
|
requirements:
|
131
|
+
- - "~>"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 3.2.1
|
101
134
|
- - ">="
|
102
135
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
136
|
+
version: '3.2'
|
104
137
|
type: :runtime
|
105
138
|
prerelease: false
|
106
139
|
version_requirements: !ruby/object:Gem::Requirement
|
107
140
|
requirements:
|
141
|
+
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 3.2.1
|
108
144
|
- - ">="
|
109
145
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
146
|
+
version: '3.2'
|
111
147
|
description: "\n Fatboy is a gem designed to easily keep track of views.\n It doesn't
|
112
148
|
touch your SQL, and stays slim in redis.\n It also makes it easy to query based
|
113
149
|
on how viewed something is.\n "
|
@@ -122,16 +158,21 @@ files:
|
|
122
158
|
- LICENSE.txt
|
123
159
|
- README.md
|
124
160
|
- Rakefile
|
161
|
+
- assets/logo-optimize.svg
|
162
|
+
- assets/logo.svg
|
125
163
|
- fatboy.gemspec
|
126
164
|
- lib/fatboy.rb
|
127
165
|
- lib/fatboy/helpers.rb
|
166
|
+
- lib/fatboy/many.rb
|
128
167
|
- lib/fatboy/popularity.rb
|
129
168
|
- lib/fatboy/time_based_popularity.rb
|
130
169
|
- lib/fatboy/version.rb
|
170
|
+
- lib/fatboy/view_tracker.rb
|
131
171
|
- lib/fatboy/viewed_item.rb
|
132
172
|
- spec/fatboy_spec.rb
|
133
173
|
- spec/mocks/model.rb
|
134
174
|
- spec/spec_helper.rb
|
175
|
+
- spec/view_tracker_spec.rb
|
135
176
|
homepage: http://github.com/AnthonySuper/fatboy
|
136
177
|
licenses:
|
137
178
|
- MIT
|
@@ -160,4 +201,5 @@ test_files:
|
|
160
201
|
- spec/fatboy_spec.rb
|
161
202
|
- spec/mocks/model.rb
|
162
203
|
- spec/spec_helper.rb
|
204
|
+
- spec/view_tracker_spec.rb
|
163
205
|
has_rdoc:
|