tallygem 1.0.0 → 1.1.0

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
  SHA256:
3
- metadata.gz: 44a3e25590d7e9a2e76c6fa66e8588ec910798d63b01488259f1770ec0a4d38c
4
- data.tar.gz: 3f97b80110783171cd05ac5decdef826fb83b5b2cd5609c9a988f4a78129ed14
3
+ metadata.gz: c537d01b6e1020dc26a7c15ec2b6a353fab4ff586e68e5ca8fc52f05f8f3f258
4
+ data.tar.gz: 2a63401043aa250992e94f03204ae3786e536f1bb9d3c8359df1851570432113
5
5
  SHA512:
6
- metadata.gz: '09bbe56180b30ec506e9ae698d1b9e4970c0682199306c69e1312d05df9b437eaa02634ecb9b9434810d8d0100bfa0ac1e673abba736176de01f26ced3431d99'
7
- data.tar.gz: 1786046cc4542783011fef1dd54df928d48f379eb181964e6793617be1a23a366b56b1304267dde53adf3308e81c92efda114d8180e530f527f37c2cced9ddab
6
+ metadata.gz: b8b3f595c4980b7a7e5cbcc5e2223fc0552d0f5e8aa7d0b023008d4c29f2e2b75f0faf03f348ba928427a65556b45fab7f6b1fe73f73943d2e2aa380ddd1963c
7
+ data.tar.gz: 2b0698e7064c5b4b8af3b60027298e71bb624d1d6a6f066e0233508c512c89372334e560e68dbe6052878f414874b3669caf0838c0c525849a1c8d62333df958
@@ -42,7 +42,8 @@ module TallyGem::Adapters
42
42
  number = message.css('.postNumber').text.delete('#').to_i
43
43
  next if number < @start_num || number > (@end_num || end_page_num * POSTS_PER_PAGE)
44
44
 
45
- id = message['id']
45
+ id_str = message['id']
46
+ id = id_str =~ /post-([0-9]+)/ ? $~.captures.first.to_i : id_str
46
47
  author = message['data-author']
47
48
  text = message.css('.messageContent article .messageText').text.strip
48
49
  TallyGem::Post.new(id, number, author, text)
@@ -16,13 +16,13 @@ module TallyGem::Printers
16
16
  votes = votes.sort_by { |_, v| v[:posts].size }.reverse!
17
17
  votes.each do |_, vote|
18
18
  sb << Common.render_vote(vote[:vote])
19
- sb << bold("No. of Votes: #{vote[:posts].size}")
20
- sb << spoiler(vote[:posts].collect(&:author).join("\n"), 'Voters') unless compact
19
+ sb << bold("Number of voters: #{vote[:posts].size}")
20
+ sb << vote[:posts].collect { |p| post_link(p.author, p.id) }.join(', ') unless compact
21
21
  sb.last << "\n"
22
22
  end
23
23
  output << sb.join("\n")
24
24
  end
25
- output << "\n" + "Total No. of Voters: #{tally.total_voters}"
25
+ output << "\n" + "Total number of voters: #{tally.total_voters}"
26
26
  output.join "\n"
27
27
  end
28
28
 
@@ -40,7 +40,7 @@ module TallyGem::Printers
40
40
  "[hr]#{str}[/hr]"
41
41
  end
42
42
 
43
- def spoiler(str, name=nil)
43
+ def spoiler(str, name = nil)
44
44
  if name.nil?
45
45
  "[spoiler]\n#{str}\n[/spoiler]"
46
46
  else
@@ -52,6 +52,10 @@ module TallyGem::Printers
52
52
  "[url=\"#{link}\"]#{str}[/url]"
53
53
  end
54
54
 
55
+ def post_link(str, id)
56
+ "[post=#{id}]#{str}[/post]"
57
+ end
58
+
55
59
  def invisitext(str)
56
60
  "[color=transparent]#{str}[/color]"
57
61
  end
@@ -1,3 +1,3 @@
1
1
  module TallyGem
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
data/tallygem.gemspec CHANGED
@@ -30,7 +30,6 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'minitest'
31
31
  spec.add_development_dependency 'rake', '~> 10.0'
32
32
  spec.add_development_dependency 'rspec'
33
- spec.add_dependency 'contracts'
34
33
  spec.add_dependency 'nokogiri'
35
34
  spec.add_dependency 'parslet'
36
35
  spec.add_dependency 'slop'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tallygem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katherine Whitlock
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: contracts
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: nokogiri
85
71
  requirement: !ruby/object:Gem::Requirement