hatebu_entry 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0aab4957200e35089c390385b7783515754062e9
4
- data.tar.gz: 34e4799ece62fabbfecaa37c488ed7a53a6b383d
3
+ metadata.gz: dfc791c59fc9c6d54a195faabf92c4ba1e0e975f
4
+ data.tar.gz: cefb430f9a0c13c15091c68623a71ec88ad425b2
5
5
  SHA512:
6
- metadata.gz: 7a780f297fd288a18adfecbdf8fc17acd19c6f012fe129d15154229094468bb443ef1e77ac9a8ec608b0e17634a6e8cfbaa10590abfb96456eef27408cd78be5
7
- data.tar.gz: 06a8e2c519b77497d4c88a48904670bef01b5bee8fed6ca31cd5548c0ac00ae2d581a313d190af8684e4a5ae0f082db4198781beb9ab0830a2c4b9902da5871b
6
+ metadata.gz: c5d180e72f0c58a6cc784aace4e863c6b7e987d168e04e5770bc5a40d4ccb2743e54dd6eddaf51dad4fbd34fe3c15f00ebb5e557c56570939496996fa12ebdfd
7
+ data.tar.gz: 64cdf4b601d521e24a91b74599e91f0abe17d7f1824bc9827d44ccedbd4736f7c3218a9632c7b3ea8837c21657191ee25106ca0d2c03aa6b8dcec81dd7abe2c8
@@ -2,8 +2,8 @@ require 'thor'
2
2
 
3
3
  class HatebuEntry::Command < Thor
4
4
  desc "get URL", "Get Hatena bookmark entries for URL"
5
- option :pages, aliases:"-p", default:0
6
- option :sort, aliases:"-s", default:"count"
5
+ option :pages, aliases:"-p", default:0, desc:"10 entries in default, takes 20 each by 1 or more"
6
+ option :sort, aliases:"-s", default:"count", desc:"count, hot or eid are acceptable"
7
7
  def get(url)
8
8
  entries = HatebuEntry.new(url, options[:sort])
9
9
  .entries(options[:pages].to_i)
@@ -1,3 +1,3 @@
1
1
  class HatebuEntry
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/sample/sample.rb CHANGED
@@ -4,26 +4,21 @@ githubio = 'http://melborne.github.io'
4
4
  githubcom = 'http://melborne.github.com'
5
5
  hatena = 'http://d.hatena.ne.jp/keyesberry'
6
6
 
7
- def get_entries(url_list, pages=1)
8
- url_list.map do |url|
9
- puts "Bookmark entries retrieving from #{url}..."
10
- HatebuEntry.new(url).entries(pages).tap do |s|
11
- puts "#{s.size} entries retrieved."
12
- end
7
+ def get_entries(url, pages=1)
8
+ puts "Bookmark entries retrieving from #{url}..."
9
+ HatebuEntry.new(url).entries(pages).tap do |s|
10
+ puts "#{s.size} entries retrieved."
13
11
  end
14
12
  end
15
13
 
16
- gitio_ent, gitcom_ent, hatena_ent = get_entries([githubio, githubcom, hatena], 5)
14
+ entries = [githubio, githubcom, hatena].map { |url| get_entries url, 2 }
17
15
 
18
16
  puts "\nMerging entries..."
17
+ merged = entries.inject { |mem, ent| HatebuEntry::Entry.merge mem, ent }
19
18
 
20
- entries = HatebuEntry::Entry.merge(gitio_ent, gitcom_ent)
21
- entries = HatebuEntry::Entry.merge(entries, hatena_ent)
22
-
23
- puts "\nFollowing is top 20 entries."
19
+ puts "\nFollowing is top 20 entries from 3 sites."
24
20
  puts
25
-
26
- puts entries.lazy
27
- .sort_by{ |e| -e.count }
28
- .map { |h| "%i: %s (%s)" % [h.count, h.title, h.link] }
29
- .take(20)
21
+ puts merged.lazy
22
+ .sort_by{ |e| -e.count }
23
+ .map { |h| "%i: %s (%s)" % [h.count, h.title, h.link] }
24
+ .take(20)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hatebu_entry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - kyoendo