beer_bash 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/beer_bash.rb +14 -1
- data/lib/beer_bash/beer_menus.rb +3 -2
- data/lib/beer_bash/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f1bd29b0ac97815e15f064587d92d33cc2bfa6a
|
4
|
+
data.tar.gz: cdb3f148dfca0310304ff9cb8d0ff7fe88f396ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 347c7fd4067ea8689156ee9c74cd83a93eead2b1e3c040593b8e5168be79bfbc33c62dc43a52f74906f3ff2df9b0351ec0202b56e69a4c482256a9f12451c92a
|
7
|
+
data.tar.gz: 114696c4f03b3ff4c23448b8f08b5203ee2c1f409433bc596a76262249b38a03da094a11d1a99c1a02e73c4b2d42eb99d651faad0b7d7d7ac11c1e337abeceef
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ This only pulls from BeerMenus currently, but perhaps that will change.
|
|
15
15
|
$ ontap at the owl farm
|
16
16
|
|
17
17
|
+----------------------------------------------------+------+-------------+--------+
|
18
|
-
| The Owl Farm * Updated
|
18
|
+
| The Owl Farm * Updated Today! |
|
19
19
|
+----------------------------------------------------+------+-------------+--------+
|
20
20
|
| Beer | ABV | Format | Price |
|
21
21
|
+----------------------------------------------------+------+-------------+--------+
|
data/lib/beer_bash.rb
CHANGED
@@ -26,7 +26,7 @@ module BeerBash
|
|
26
26
|
tap_list = place.on_tap
|
27
27
|
|
28
28
|
table = Terminal::Table.new do |t|
|
29
|
-
t.title = "#{place} * Updated
|
29
|
+
t.title = "#{place} * Updated #{format_date(tap_list.updated_at)}"
|
30
30
|
t.headings = %w(Beer ABV Format Price)
|
31
31
|
t.rows = tap_list.taps.collect {|beer| [beer.name, beer.abv, beer.format, beer.price]}
|
32
32
|
(1..3).each {|idx| t.align_column(idx, :right)}
|
@@ -34,5 +34,18 @@ module BeerBash
|
|
34
34
|
|
35
35
|
puts table
|
36
36
|
end
|
37
|
+
|
38
|
+
def format_date(date)
|
39
|
+
days_ago = (Date.today - date).to_i
|
40
|
+
case days_ago
|
41
|
+
when 0 then 'Today!'
|
42
|
+
when 1 then 'Yesterday'
|
43
|
+
when 2 then 'a Couple Days Ago'
|
44
|
+
when 3 then 'a Few Days Ago'
|
45
|
+
when 4..6 then "#{days_ago} Days Ago"
|
46
|
+
when 7 then 'a Week Ago'
|
47
|
+
else "Waaay Back on #{date.strftime('%m/%d/%Y')}"
|
48
|
+
end
|
49
|
+
end
|
37
50
|
end
|
38
51
|
end
|
data/lib/beer_bash/beer_menus.rb
CHANGED
@@ -63,8 +63,9 @@ module BeerBash
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def find_updated(page)
|
66
|
-
page.search('//div[contains(@class,"content")]/p[contains(text(),"Updated: ")]')
|
67
|
-
|
66
|
+
date = page.search('//div[contains(@class,"content")]/p[contains(text(),"Updated: ")]')
|
67
|
+
.first.text.strip.match(/Updated: (.*)/)[1]
|
68
|
+
Date.strptime(date, '%m/%d/%Y')
|
68
69
|
end
|
69
70
|
|
70
71
|
def find_taps(page)
|
data/lib/beer_bash/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beer_bash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Evanoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|