Class: BCDice::DiceTable::D66OneThirdTable

Inherits:
D66GridTable show all
Defined in:
lib/bcdice/dice_table/d66_one_third_table.rb

Overview

D66を振って6x6マスの表を参照する

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from D66GridTable

#roll

Constructor Details

#initialize(name, items_1_2, items_3_4, items_5_6) ⇒ D66OneThirdTable

Returns a new instance of D66OneThirdTable.

Parameters:

  • name (String)

    表の名前

  • items_1_2 (Array<String>)
  • items_3_4 (Array<String>)
  • items_5_6 (Array<String>)


21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bcdice/dice_table/d66_one_third_table.rb', line 21

def initialize(name, items_1_2, items_3_4, items_5_6)
  @name = name
  @items = [
    items_1_2,
    items_1_2,
    items_3_4,
    items_3_4,
    items_5_6,
    items_5_6,
  ].freeze
end

Class Method Details

.from_i18n(key, locale) ⇒ D66OneThirdTable

Parameters:

  • key (String)
  • locale (Symbol)

Returns:



12
13
14
15
# File 'lib/bcdice/dice_table/d66_one_third_table.rb', line 12

def self.from_i18n(key, locale)
  table = I18n.t(key, locale: locale, raise: true)
  new(table[:name], table[:items_1_2], table[:items_3_4], table[:items_5_6])
end