beer_list 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -6
- data/beer_list.gemspec +1 -1
- data/lib/beer_list/establishments/establishment.rb +1 -1
- data/lib/beer_list/establishments.rb +1 -1
- data/lib/beer_list/list.rb +3 -2
- data/lib/beer_list.rb +2 -7
- data/spec/lib/beer_list/list_spec.rb +7 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -103,18 +103,17 @@ the following code in an initializer:
|
|
103
103
|
|
104
104
|
`BeerList.establishments_dir = File.join(Rails.root, 'path/to/establishments')`
|
105
105
|
|
106
|
-
When using Rails, you'll need to register your establishments with BeerList.
|
107
|
-
Unfortunately, you can't call them directly (I'm working on it):
|
108
106
|
|
109
107
|
```
|
108
|
+
# Fetch just the list at Applebirds
|
109
|
+
BeerList.applebirds
|
110
|
+
|
111
|
+
# Or, register your establishment
|
110
112
|
BeerList.add_establishment(BeerList::Establishments::Applebirds.new)
|
111
113
|
|
112
|
-
# fetch all your lists, including the one at Applebirds
|
114
|
+
# fetch all your registered lists, including the one at Applebirds
|
113
115
|
BeerList.lists
|
114
116
|
|
115
|
-
# Unsupported in Rails (for now)
|
116
|
-
BeerList.applebirds
|
117
|
-
|
118
117
|
```
|
119
118
|
|
120
119
|
See [Getting A List](https://github.com/DanOlson/beer_list#getting-a-list) for more details.
|
data/beer_list.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'beer_list'
|
3
|
-
spec.version = '0.1.
|
3
|
+
spec.version = '0.1.3'
|
4
4
|
spec.authors = ['Dan Olson']
|
5
5
|
spec.email = ['olson_dan@yahoo.com']
|
6
6
|
spec.description = 'A utility for retrieving the beer list from various establishments'
|
data/lib/beer_list/list.rb
CHANGED
data/lib/beer_list.rb
CHANGED
@@ -75,14 +75,9 @@ module BeerList
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def method_missing(method, *args, &block)
|
78
|
-
super if defined? Rails
|
79
78
|
class_name = method.to_s.split('_').map(&:capitalize).join
|
80
|
-
|
81
|
-
|
82
|
-
scraper.beer_list klass.new
|
83
|
-
rescue NameError
|
84
|
-
super method, *args, &block
|
85
|
-
end
|
79
|
+
klass = ['BeerList', 'Establishments', class_name].inject(Object){ |o, name| o.const_get(name) }
|
80
|
+
scraper.beer_list klass.new
|
86
81
|
end
|
87
82
|
end
|
88
83
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
module BeerList
|
4
4
|
describe List do
|
5
5
|
let(:est_name){ 'MuddyWaters' }
|
6
|
-
let(:list){ List.new [], est_name}
|
6
|
+
let(:list){ List.new array: [], establishment: est_name }
|
7
7
|
|
8
8
|
it 'knows its establishent' do
|
9
9
|
list.establishment.should == est_name
|
@@ -22,5 +22,11 @@ module BeerList
|
|
22
22
|
list.to_json.should == expected
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
context 'when array is nil (the establishment has yet to implement #get_list)' do
|
27
|
+
let(:list){ List.new array: nil, establishment: est_name }
|
28
|
+
|
29
|
+
it { list.should be_empty }
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beer_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mechanize
|