Skip to content

Commit 7ffd54a

Browse files
committed
BCDice 3.0.0-alpha.2に対応
1 parent c8dfa3a commit 7ffd54a

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
source 'https://rubygems.org'
44

5-
gem 'bcdice', '3.0.0.pre.alpha.1'
5+
gem 'bcdice', '3.0.0.pre.alpha.2'
66

77
gem 'sinatra', '~>2.0'
88
gem 'sinatra-contrib', '~>2.0'

Gemfile.lock

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ GEM
33
specs:
44
ast (2.4.0)
55
backports (3.16.1)
6-
bcdice (3.0.0.pre.alpha.1)
6+
bcdice (3.0.0.pre.alpha.2)
7+
i18n (~> 1.8.5)
8+
concurrent-ruby (1.1.7)
9+
i18n (1.8.5)
10+
concurrent-ruby (~> 1.0)
711
jaro_winkler (1.5.4)
812
multi_json (1.14.1)
913
mustermann (1.1.1)
@@ -58,7 +62,7 @@ PLATFORMS
5862
ruby
5963

6064
DEPENDENCIES
61-
bcdice (= 3.0.0.pre.alpha.1)
65+
bcdice (= 3.0.0.pre.alpha.2)
6266
puma (~> 4.3)
6367
rack-test (~> 1.1)
6468
rake (~> 13.0)

bcdice

Submodule bcdice updated 367 files

lib/bcdice_api/app.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ def diceroll(system, command)
3535

3636
raise CommandError if result.nil?
3737

38-
dices = dicebot.randomizer.rand_results.map { |dice| { faces: dice[1], value: dice[0] } }
39-
detailed_rands = dicebot.randomizer.detailed_rand_results.map(&:to_h)
38+
dices = result.rands.map { |dice| { faces: dice[1], value: dice[0] } }
39+
detailed_rands = result.detailed_rands.map(&:to_h)
4040

4141
{
4242
ok: true,
43-
result: ": #{result}",
44-
secret: dicebot.secret?,
43+
result: ": #{result.text}",
44+
secret: result.secret?,
4545
dices: dices,
4646
detailed_rands: detailed_rands
4747
}

test/test_dicebot.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,13 @@ def app
1818
data_set = {}
1919
files = Dir.glob('bcdice/test/data/*.toml')
2020

21-
class_name_to_id = BCDice.all_game_systems.map do |k|
22-
name = k.name.split('::').last
23-
[name, k::ID]
24-
end.to_h
25-
2621
files.each do |filename|
2722
filename_base = File.basename(filename, '.toml')
2823
data = Tomlrb.load_file(filename, symbolize_keys: true)
2924

3025
data[:test].each.with_index(1) do |test_case, index|
3126
test_case[:filename] = filename
32-
test_case[:game_system] = class_name_to_id[test_case[:game_system]]
27+
test_case[:game_system] = test_case[:game_system]
3328
test_case[:output] = ": #{test_case[:output]}" unless test_case[:output].empty?
3429
test_case[:output] = nil if test_case[:output].empty? # TOMLではnilを表現できないので空文字で代用
3530
test_case[:secret] ||= false

0 commit comments

Comments
 (0)