ruboty-rating 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc543934aa2a1d16f429c190f35c2c6c22de7845
4
- data.tar.gz: 1723800dce611197bf767c9dcfb5d2c09fa3cfa3
3
+ metadata.gz: b58e7744979bc6e08fc02b0bdc93ea27e9377864
4
+ data.tar.gz: '097b652fcb98ba3f4087c10963310eda36f65597'
5
5
  SHA512:
6
- metadata.gz: d0fed7416f26634ecdc237b69fb42bdccb52ed8fb65a245fac3cd77a248571cb85dff5f63bbef5df9b826078bcdc119b464203b7d450f03ea04cc89f2b88d197
7
- data.tar.gz: e1fd7cb9344c567247a2bfbb968db13baa05c1f1adbeb3ddb913153d2739be40124b8ba6e0ba49739eff1620b9fd809da0c10d4cbb4e6db277b356c344961b41
6
+ metadata.gz: 35ef5956853504478aa2ce06c239c0e44eb57588697ca33154b215379cacc637fb808322db4909548463b40004e9e7d948ca8fae7b78786ca3afcd260bf2ed72
7
+ data.tar.gz: d16259b256d43583f34b875d988e0ed90050a38084c2a9f61619e86e044d330d96feb36692ca8cb09962e361f62076e6a4dadc388494fba5853cdcd0771a7333
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Ruboty::Rating
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ruboty/rating`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Run [Elo rating](https://en.wikipedia.org/wiki/Elo_rating_system) system on Ruboty.
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,7 +20,43 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ ```
24
+ $ ruboty
25
+ Type `exit` or `quit` to end the session.
26
+ > @ruboty help
27
+ ruboty /(?<left_player>\w+)(?:\s+)(?<result>[<>])(?:\s+)(?<right_player>\w+)$/ - Remember a game result
28
+ ruboty /delete\s+player\s+(?<player>\w+)/ - Show rating of a player
29
+ ruboty /set\s+rating\s+(?<player>\w+)\s+(?<new_rating>\d+)/ - Set rating of a player manually
30
+ ruboty /show\s+rating\s+(?<player>\w+)/ - Show rating of a player
31
+ ruboty /show\s+ratings/ - Show ratings of all player
32
+ ruboty /help( me)?(?: (?<filter>.+))?\z/i - Show this help message
33
+ ruboty /ping\z/i - Return PONG to PING
34
+ ruboty /who am i\?/i - Answer who you are
35
+ > @ruboty player1 > player2
36
+ player1: 1500 -> 1512
37
+ player2: 1500 -> 1488
38
+ > @ruboty player3 > player2
39
+ player3: 1500 -> 1512
40
+ player2: 1488 -> 1476
41
+ > @ruboty player1 > player4
42
+ player1: 1512 -> 1524
43
+ player4: 1500 -> 1488
44
+ > @ruboty show ratings
45
+ player1: 1524
46
+ player3: 1512
47
+ player4: 1488
48
+ player2: 1476
49
+ > @ruboty set rating player1 530000
50
+ Updated the rating of player1: 530000
51
+ > @ruboty show rating player1
52
+ player1: 530000
53
+ > @ruboty delete player player2
54
+ Deleted player2
55
+ > @ruboty show ratings
56
+ player1: 530000
57
+ player3: 1512
58
+ player4: 1488
59
+ ```
26
60
 
27
61
  ## Development
28
62
 
@@ -32,5 +66,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
66
 
33
67
  ## Contributing
34
68
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ruboty-rating. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
69
+ Bug reports and pull requests are welcome on GitHub at https://github.com/tomoasleep/ruboty-rating. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
70
 
@@ -49,8 +49,8 @@ module Ruboty
49
49
  Ruboty::Rating::Actions::SetRating.new(message).call
50
50
  end
51
51
 
52
- def set_rating(message)
53
- Ruboty::Rating::Actions::SetRating.new(message).call
52
+ def delete_player(message)
53
+ Ruboty::Rating::Actions::DeletePlayer.new(message).call
54
54
  end
55
55
  end
56
56
  end
@@ -4,7 +4,7 @@ module Ruboty
4
4
  class DeletePlayer < Base
5
5
  def call
6
6
  ratings.delete(player)
7
- message.reply("Removed #{player}")
7
+ message.reply("Deleted #{player}")
8
8
  end
9
9
 
10
10
  private
@@ -3,7 +3,7 @@ module Ruboty
3
3
  module Actions
4
4
  class ShowRatings < Base
5
5
  def call
6
- rating_ranking = ratings.sort { |(_player, rating)| -rating }
6
+ rating_ranking = ratings.sort_by { |(_player, rating)| -rating }
7
7
  message.reply(rating_ranking.map { |(player, rating)| "#{player}: #{rating}" }.join("\n"))
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Rating
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-rating
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomoya Chiba