Module: Unisat
- Defined in:
- lib/unisat.rb,
lib/unisat/cache.rb,
lib/unisat/version.rb
Defined Under Namespace
Modules: Puppeteer
Classes: Cache
Constant Summary
collapse
- MAJOR =
sync version w/ sport.db n friends - why? why not?
0
- MINOR =
todo: namespace inside version or something - why? why not??
1
- PATCH =
0
- VERSION =
[MAJOR,MINOR,PATCH].join('.')
Class Method Summary
collapse
Class Method Details
.banner ⇒ Object
14
15
16
|
# File 'lib/unisat/version.rb', line 14
def self.banner
"unisat/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] in >#{root}<"
end
|
.cache ⇒ Object
5
|
# File 'lib/unisat/cache.rb', line 5
def self.cache() @cache ||= Cache.new( './unisat' ); end
|
.cache_dir=(dir) ⇒ Object
todo: use a config block in the future - why? why not?
4
|
# File 'lib/unisat/cache.rb', line 4
def self.cache_dir=( dir ) @cache = Cache.new( dir ); end
|
.parse_page(html) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/unisat/cache.rb', line 8
def self.parse_page( html )
doc = Nokogiri::HTML( html )
items = []
sats = doc.css( '.item-container' )
sats.each_with_index do |el,i|
puts "==> sat ##{i+1}/#{sats.size}..."
h = {}
a = el.at( 'a.sats-item' )
h['href'] = a['href']
name = el.at( '.name' )
h['name'] = name.text
num = el.at( '.num' )
h['num'] = num.text
address = el.at( '.address' )
h['address'] = address.text
date = el.at( '.date' )
h['date'] = date.text
items << h
end
items
end
|
.root ⇒ Object
18
19
20
|
# File 'lib/unisat/version.rb', line 18
def self.root
File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
end
|
.version ⇒ Object
10
11
12
|
# File 'lib/unisat/version.rb', line 10
def self.version
VERSION
end
|